llvm.org GIT mirror llvm / d6d0185
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 Erick Tryzelaar 12 years ago
5 changed file(s) with 39 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
5757 LLVMVerifyFunction(Fn, LLVMAbortProcessAction);
5858 return Val_unit;
5959 }
60
61 /* Llvm.llvalue -> unit */
62 CAMLprim value llvm_view_function_cfg(LLVMValueRef Fn) {
63 LLVMViewFunctionCFG(Fn);
64 return Val_unit;
65 }
66
67 /* Llvm.llvalue -> unit */
68 CAMLprim value llvm_view_function_cfg_only(LLVMValueRef Fn) {
69 LLVMViewFunctionCFGOnly(Fn);
70 return Val_unit;
71 }
1616
1717 external assert_valid_function : Llvm.llvalue -> unit
1818 = "llvm_assert_valid_function"
19 external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
20 external view_function_cfg_only : Llvm.llvalue -> unit
21 = "llvm_view_function_cfg_only"
3232 [llvm::verifyFunction]. *)
3333 external assert_valid_function : Llvm.llvalue -> unit
3434 = "llvm_assert_valid_function"
35
36 (** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
37 the current function with the code for each basic block inside.
38 See [llvm::Function::viewCFG]. *)
39 external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
40
41 (** [view_function_cfg_only f] works just like [view_function_cfg], but does not
42 include the contents of basic blocks into the nodes.
43 See [llvm::Function::viewCFGOnly]. *)
44 external view_function_cfg_only : Llvm.llvalue -> unit
45 = "llvm_view_function_cfg_only"
4242 for debugging. */
4343 int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
4444
45 /* Open up a ghostview window that displays the CFG of the current function.
46 Useful for debugging. */
47 void LLVMViewFunctionCFG(LLVMValueRef Fn);
48 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
4549
4650 #ifdef __cplusplus
4751 }
3232 static_cast(Action));
3333 }
3434
35 void LLVMViewFunctionCFG(LLVMValueRef Fn) {
36 Function *F = unwrap(Fn);
37 F->viewCFG();
38 }
39
40 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
41 Function *F = unwrap(Fn);
42 F->viewCFGOnly();
43 }