[llvm-commits] [llvm] r97412 - in /llvm/trunk: bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli bindings/ocaml/llvm/llvm_ocaml.c test/Bindings/Ocaml/vmcore.ml
Erick Tryzelaar
idadesub at users.sourceforge.net
Sun Feb 28 12:44:53 PST 2010
Author: erickt
Date: Sun Feb 28 14:44:53 2010
New Revision: 97412
URL: http://llvm.org/viewvc/llvm-project?rev=97412&view=rev
Log:
Add support for inserting inline asm to ocaml.
Modified:
llvm/trunk/bindings/ocaml/llvm/llvm.ml
llvm/trunk/bindings/ocaml/llvm/llvm.mli
llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
llvm/trunk/test/Bindings/Ocaml/vmcore.ml
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=97412&r1=97411&r2=97412&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Sun Feb 28 14:44:53 2010
@@ -356,6 +356,9 @@
= "llvm_const_extractvalue"
external const_insertvalue : llvalue -> llvalue -> int array -> llvalue
= "llvm_const_insertvalue"
+external const_inline_asm : lltype -> string -> string -> bool -> bool ->
+ llvalue
+ = "llvm_const_inline_asm"
external block_address : llvalue -> llbasicblock -> llvalue = "LLVMBlockAddress"
(*--... Operations on global variables, functions, and aliases (globals) ...--*)
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=97412&r1=97411&r2=97412&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Sun Feb 28 14:44:53 2010
@@ -964,6 +964,12 @@
external const_insertvalue : llvalue -> llvalue -> int array -> llvalue
= "llvm_const_insertvalue"
+(** [const_inline_asm ty asm con side align] inserts a inline assembly string.
+ See the method [llvm::InlineAsm::get]. *)
+external const_inline_asm : lltype -> string -> string -> bool -> bool ->
+ llvalue
+ = "llvm_const_inline_asm"
+
(** [block_address f bb] returns the address of the basic block [bb] in the
function [f]. See the method [llvm::BasicBlock::get]. *)
external block_address : llvalue -> llbasicblock -> llvalue = "LLVMBlockAddress"
Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=97412&r1=97411&r2=97412&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Sun Feb 28 14:44:53 2010
@@ -641,6 +641,14 @@
CAMLreturnT(LLVMValueRef, result);
}
+/* lltype -> string -> string -> bool -> bool -> llvalue */
+CAMLprim LLVMValueRef llvm_const_inline_asm(LLVMTypeRef Ty, value Asm,
+ value Constraints, value HasSideEffects,
+ value IsAlignStack) {
+ return LLVMConstInlineAsm(Ty, String_val(Asm), String_val(Constraints),
+ Bool_val(HasSideEffects), Bool_val(IsAlignStack));
+}
+
/*--... Operations on global variables, functions, and aliases (globals) ...--*/
/* llvalue -> bool */
Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=97412&r1=97411&r2=97412&view=diff
==============================================================================
--- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original)
+++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Sun Feb 28 14:44:53 2010
@@ -456,7 +456,17 @@
ignore (define_global "const_shufflevector" (const_shufflevector
(const_vector [| zero; one |])
(const_vector [| one; zero |])
- (const_bitcast foldbomb (vector_type i32_type 2))) m)
+ (const_bitcast foldbomb (vector_type i32_type 2))) m);
+
+ group "asm"; begin
+ let ft = function_type void_type [| i32_type; i32_type; i32_type |] in
+ ignore (const_inline_asm
+ ft
+ ""
+ "{cx},{ax},{di},~{dirflag},~{fpsr},~{flags},~{edi},~{ecx}"
+ true
+ false)
+ end
(*===-- Global Values -----------------------------------------------------===*)
More information about the llvm-commits
mailing list