mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Expose Function::viewCFG and Function::viewCFGOnly to bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48982 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
86550b0a14
commit
d6d018589c
@ -58,3 +58,15 @@ CAMLprim value llvm_assert_valid_function(LLVMValueRef Fn) {
|
||||
LLVMVerifyFunction(Fn, LLVMAbortProcessAction);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* Llvm.llvalue -> unit */
|
||||
CAMLprim value llvm_view_function_cfg(LLVMValueRef Fn) {
|
||||
LLVMViewFunctionCFG(Fn);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* Llvm.llvalue -> unit */
|
||||
CAMLprim value llvm_view_function_cfg_only(LLVMValueRef Fn) {
|
||||
LLVMViewFunctionCFGOnly(Fn);
|
||||
return Val_unit;
|
||||
}
|
||||
|
@ -17,3 +17,6 @@ external assert_valid_module : Llvm.llmodule -> unit
|
||||
|
||||
external assert_valid_function : Llvm.llvalue -> unit
|
||||
= "llvm_assert_valid_function"
|
||||
external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
|
||||
external view_function_cfg_only : Llvm.llvalue -> unit
|
||||
= "llvm_view_function_cfg_only"
|
||||
|
@ -33,3 +33,14 @@ external assert_valid_module : Llvm.llmodule -> unit
|
||||
[llvm::verifyFunction]. *)
|
||||
external assert_valid_function : Llvm.llvalue -> unit
|
||||
= "llvm_assert_valid_function"
|
||||
|
||||
(** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
|
||||
the current function with the code for each basic block inside.
|
||||
See [llvm::Function::viewCFG]. *)
|
||||
external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
|
||||
|
||||
(** [view_function_cfg_only f] works just like [view_function_cfg], but does not
|
||||
include the contents of basic blocks into the nodes.
|
||||
See [llvm::Function::viewCFGOnly]. *)
|
||||
external view_function_cfg_only : Llvm.llvalue -> unit
|
||||
= "llvm_view_function_cfg_only"
|
||||
|
@ -43,6 +43,10 @@ int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
|
||||
for debugging. */
|
||||
int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
|
||||
|
||||
/* Open up a ghostview window that displays the CFG of the current function.
|
||||
Useful for debugging. */
|
||||
void LLVMViewFunctionCFG(LLVMValueRef Fn);
|
||||
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -33,3 +33,12 @@ int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
|
||||
static_cast<VerifierFailureAction>(Action));
|
||||
}
|
||||
|
||||
void LLVMViewFunctionCFG(LLVMValueRef Fn) {
|
||||
Function *F = unwrap<Function>(Fn);
|
||||
F->viewCFG();
|
||||
}
|
||||
|
||||
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
|
||||
Function *F = unwrap<Function>(Fn);
|
||||
F->viewCFGOnly();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user