Skip to content

Commit

Permalink
[pliron-llvm] Add module, value and type dump functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha committed Aug 1, 2024
1 parent 2cf3da0 commit a650703
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pliron-llvm/src/llvm_sys/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use llvm_sys::{
LLVMClearInsertionPosition, LLVMConstInt, LLVMConstIntGetZExtValue, LLVMContextCreate,
LLVMCountIncoming, LLVMCountParamTypes, LLVMCountParams, LLVMCountStructElementTypes,
LLVMCreateBuilderInContext, LLVMCreateMemoryBufferWithContentsOfFile,
LLVMDisposeMemoryBuffer, LLVMDisposeMessage, LLVMDisposeModule, LLVMFunctionType,
LLVMGetAllocatedType, LLVMGetArrayLength2, LLVMGetBasicBlockName,
LLVMGetBasicBlockTerminator, LLVMGetConstOpcode, LLVMGetElementType,
LLVMDisposeMemoryBuffer, LLVMDisposeMessage, LLVMDisposeModule, LLVMDumpModule,
LLVMDumpType, LLVMDumpValue, LLVMFunctionType, LLVMGetAllocatedType, LLVMGetArrayLength2,
LLVMGetBasicBlockName, LLVMGetBasicBlockTerminator, LLVMGetConstOpcode, LLVMGetElementType,
LLVMGetFirstBasicBlock, LLVMGetFirstFunction, LLVMGetFirstInstruction, LLVMGetFirstParam,
LLVMGetICmpPredicate, LLVMGetIncomingBlock, LLVMGetIncomingValue, LLVMGetInsertBlock,
LLVMGetInstructionOpcode, LLVMGetInstructionParent, LLVMGetIntTypeWidth,
Expand Down Expand Up @@ -153,6 +153,21 @@ pub fn llvm_get_module_identifier(module: &LLVMModule) -> Option<String> {
sized_cstr_to_string(buf_ptr, len)
}

/// LLVMDumpValue
pub fn llvm_dump_value(val: LLVMValue) {
unsafe { LLVMDumpValue(val.into()) }
}

/// LLVMDumpType
pub fn llvm_dump_type(ty: LLVMType) {
unsafe { LLVMDumpType(ty.into()) }
}

/// LLVMDumpModule
pub fn llvm_dump_module(module: &LLVMModule) {
unsafe { LLVMDumpModule(module.module_ref) }
}

/// The family of LLVMIsA* functions for Value
pub mod llvm_is_a {
use llvm_sys::core::{
Expand Down

0 comments on commit a650703

Please sign in to comment.