mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
[OCaml] Add Llvm.build_empty_phi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52e57900a3
commit
f6943689d2
@ -1300,6 +1300,8 @@ external build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
|
||||
(*--... Miscellaneous instructions .........................................--*)
|
||||
external build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
|
||||
llvalue = "llvm_build_phi"
|
||||
external build_empty_phi : lltype -> string -> llbuilder -> llvalue
|
||||
= "llvm_build_empty_phi"
|
||||
external build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue
|
||||
= "llvm_build_call"
|
||||
external build_select : llvalue -> llvalue -> llvalue -> string -> llbuilder ->
|
||||
|
@ -2422,6 +2422,12 @@ val build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
|
||||
val build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
|
||||
llvalue
|
||||
|
||||
(** [build_empty_phi ty name b] creates a
|
||||
[%name = phi %ty] instruction at the position specified by
|
||||
the instruction builder [b]. [ty] is the type of the instruction.
|
||||
See the method [llvm::LLVMBuilder::CreatePHI]. *)
|
||||
val build_empty_phi : lltype -> string -> llbuilder -> llvalue
|
||||
|
||||
(** [build_call fn args name b] creates a
|
||||
[%name = call %fn(args...)]
|
||||
instruction at the position specified by the instruction builder [b].
|
||||
|
@ -2191,6 +2191,15 @@ CAMLprim LLVMValueRef llvm_build_phi(value Incoming, value Name, value B) {
|
||||
return PhiNode;
|
||||
}
|
||||
|
||||
/* lltype -> string -> llbuilder -> value */
|
||||
CAMLprim LLVMValueRef llvm_build_empty_phi(LLVMTypeRef Type, value Name, value B) {
|
||||
LLVMValueRef PhiNode;
|
||||
|
||||
return LLVMBuildPhi(Builder_val(B), Type, String_val(Name));
|
||||
|
||||
return PhiNode;
|
||||
}
|
||||
|
||||
/* llvalue -> llvalue array -> string -> llbuilder -> llvalue */
|
||||
CAMLprim LLVMValueRef llvm_build_call(LLVMValueRef Fn, value Params,
|
||||
value Name, value B) {
|
||||
|
@ -1428,6 +1428,15 @@ let test_builder () =
|
||||
add_incoming (p2, b2) phi;
|
||||
insist ([(p1, b1); (p2, b2)] = incoming phi);
|
||||
|
||||
(* CHECK: %PhiEmptyNode = phi i8
|
||||
*)
|
||||
let phi_empty = build_empty_phi i8_type "PhiEmptyNode" at_jb in
|
||||
insist ([] = incoming phi_empty);
|
||||
|
||||
(* can't emit an empty phi to bitcode *)
|
||||
add_incoming (const_int i8_type 1, b1) phi_empty;
|
||||
add_incoming (const_int i8_type 2, b2) phi_empty;
|
||||
|
||||
ignore (build_unreachable at_jb);
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user