aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2010-04-28 01:47:00 -0700
committerShih-wei Liao <sliao@google.com>2010-04-28 01:47:00 -0700
commit7abe37e4aee38cc79d91dd069a37d7e91d5bef53 (patch)
treec13b26fc3d8909240f981988535c0b82dd9bf37c /bindings
parent6037a7c3c97b651dd70e48ebe5453134713971ed (diff)
downloadexternal_llvm-7abe37e4aee38cc79d91dd069a37d7e91d5bef53.tar.gz
external_llvm-7abe37e4aee38cc79d91dd069a37d7e91d5bef53.tar.bz2
external_llvm-7abe37e4aee38cc79d91dd069a37d7e91d5bef53.zip
Sync upstream to r102410.
Re-turn on sdk. Change-Id: I91a890863989a67243b4d2dfd1ae09b843ebaeaf
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/Makefile.ocaml123
-rw-r--r--bindings/ocaml/llvm/llvm.ml76
-rw-r--r--bindings/ocaml/llvm/llvm.mli26
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c17
4 files changed, 181 insertions, 61 deletions
diff --git a/bindings/ocaml/Makefile.ocaml b/bindings/ocaml/Makefile.ocaml
index 4e5de80264..1cff422c28 100644
--- a/bindings/ocaml/Makefile.ocaml
+++ b/bindings/ocaml/Makefile.ocaml
@@ -66,35 +66,64 @@ Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
+ifdef OCAMLOPT
+Archive.EXE := $(strip $(OCAMLOPT) -cc $(CXX) $(OCAMLCFLAGS) $(UsedOcamLibs:%=%.cmxa) $(OCAMLDEBUGFLAG) -o)
+else
+Archive.EXE := $(strip $(OCAMLC) -cc $(CXX) $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG:%=%.cma) -o)
+endif
+
# Source files
OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml))
-OcamlHeaders1 := $(OcamlSources1:.ml=.mli)
+OcamlHeaders1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.mli))
+
+OcamlSources2 := $(filter-out $(ExcludeSources),$(OcamlSources1))
+OcamlHeaders2 := $(filter-out $(ExcludeHeaders),$(OcamlHeaders1))
-OcamlSources := $(OcamlSources1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
-OcamlHeaders := $(OcamlHeaders1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
+OcamlSources := $(OcamlSources2:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
+OcamlHeaders := $(OcamlHeaders2:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
# Intermediate files
-LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma
-LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa
ObjectsCMI := $(OcamlSources:%.ml=%.cmi)
ObjectsCMO := $(OcamlSources:%.ml=%.cmo)
ObjectsCMX := $(OcamlSources:%.ml=%.cmx)
+ifdef LIBRARYNAME
+LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma
+LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa
+endif
+
+ifdef TOOLNAME
+ToolEXE := $(ObjDir)/$(TOOLNAME)$(EXEEXT)
+endif
+
# Output files
# The .cmo files are the only intermediates; all others are to be installed.
-LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a
-OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma)
-OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa)
OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi)
OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx)
OutputLibs := $(UsedLibNames:%=$(OcamlDir)/%)
+ifdef LIBRARYNAME
+LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a
+OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma)
+OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa)
+endif
+
+ifdef TOOLNAME
+ifdef EXAMPLE_TOOL
+OutputEXE := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
+else
+OutputEXE := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
+endif
+endif
+
# Installation targets
+DestLibs := $(UsedLibNames:%=$(PROJ_libocamldir)/%)
+
+ifdef LIBRARYNAME
DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a
DestCMA := $(PROJ_libocamldir)/$(LIBRARYNAME).cma
DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa
-DestLibs := $(UsedLibNames:%=$(PROJ_libocamldir)/%)
-
+endif
##===- Dependencies -------------------------------------------------------===##
# Copy the sources into the intermediate directory because older ocamlc doesn't
@@ -106,18 +135,27 @@ $(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir
$(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir
$(Verb) $(CP) -f $< $@
+$(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
+
+ifdef LIBRARYNAME
$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
$(OcamlDir)/.dir $(ObjDir)/.dir
$(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
-$(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
-
-include $(ObjDir)/$(LIBRARYNAME).ocamldep
+endif
+
+ifdef TOOLNAME
+$(ObjDir)/$(TOOLNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
+ $(OcamlDir)/.dir $(ObjDir)/.dir
+ $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
+-include $(ObjDir)/$(TOOLNAME).ocamldep
+endif
##===- Build static library from C sources --------------------------------===##
-ifneq ($(ObjectsO),)
+ifdef LibraryA
all-local:: $(LibraryA)
clean-local:: clean-a
install-local:: install-a
@@ -160,7 +198,7 @@ $(OcamlDir)/%.o: $(LibDir)/%.o
$(Verb) ln -sf $< $@
clean-deplibs:
- $(Verb) rm -f $(OutputLibs)
+ $(Verb) $(RM) -f $(OutputLibs)
install-deplibs:
$(Verb) $(MKDIR) $(PROJ_libocamldir)
@@ -169,11 +207,12 @@ install-deplibs:
done
uninstall-deplibs:
- $(Verb) rm -f $(DestLibs)
+ $(Verb) $(RM) -f $(DestLibs)
##===- Build ocaml interfaces (.mli's -> .cmi's) --------------------------===##
+ifneq ($(OcamlHeaders),)
all-local:: build-cmis
clean-local:: clean-cmis
install-local:: install-cmis
@@ -212,10 +251,16 @@ uninstall-cmis::
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
$(RM) -f "$(PROJ_libocamldir)/$$i"; \
done
+endif
##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) -------------===##
+$(ObjDir)/%.cmo: $(ObjDir)/%.ml
+ $(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
+ $(Verb) $(Compile.CMO) $@ $<
+
+ifdef LIBRARYNAME
all-local:: $(OutputCMA)
clean-local:: clean-cma
install-local:: install-cma
@@ -228,10 +273,6 @@ $(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
$(Verb) $(Archive.CMA) $@ $(ObjectsCMO)
-$(ObjDir)/%.cmo: $(ObjDir)/%.ml
- $(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
- $(Verb) $(Compile.CMO) $@ $<
-
clean-cma::
$(Verb) $(RM) -f $(OutputCMA) $(UsedLibNames:%=$(OcamlDir)/%)
@@ -243,7 +284,7 @@ install-cma:: $(OutputCMA)
uninstall-cma::
$(Echo) "Uninstalling $(DestCMA)"
-$(Verb) $(RM) -f $(DestCMA)
-
+endif
##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===##
@@ -251,6 +292,14 @@ uninstall-cma::
# If unavailable, 'configure' will not define OCAMLOPT in Makefile.config.
ifdef OCAMLOPT
+$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx
+ $(Verb) $(CP) -f $< $@
+
+$(ObjDir)/%.cmx: $(ObjDir)/%.ml
+ $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build"
+ $(Verb) $(Compile.CMX) $@ $<
+
+ifdef LIBRARYNAME
all-local:: $(OutputCMXA) $(OutputsCMX)
clean-local:: clean-cmxa
install-local:: install-cmxa
@@ -260,18 +309,11 @@ $(OutputCMXA): $(LibraryCMXA)
$(Verb) $(CP) -f $< $@
$(Verb) $(CP) -f $(<:.cmxa=.a) $(@:.cmxa=.a)
-$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx
- $(Verb) $(CP) -f $< $@
-
$(LibraryCMXA): $(ObjectsCMX)
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
$(Verb) $(Archive.CMXA) $@ $(ObjectsCMX)
$(Verb) $(RM) -f $(@:.cmxa=.o)
-$(ObjDir)/%.cmx: $(ObjDir)/%.ml
- $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build"
- $(Verb) $(Compile.CMX) $@ $<
-
clean-cmxa::
$(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.a) $(OutputsCMX)
@@ -295,7 +337,27 @@ uninstall-cmxa::
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
$(RM) -f $(PROJ_libocamldir)/$$i; \
done
+endif
+endif
+
+##===- Build executables --------------------------------------------------===##
+
+ifdef TOOLNAME
+all-local:: $(OutputEXE)
+clean-local:: clean-exe
+
+$(OutputEXE): $(ToolEXE) $(OcamlDir)/.dir
+ $(Verb) $(CP) -f $< $@
+ifndef OCAMLOPT
+$(ToolEXE): $(ObjectsCMO) $(OcamlDir)/.dir
+ $(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
+ $(Verb) $(Archive.EXE) $@ $<
+else
+$(ToolEXE): $(ObjectsCMX) $(OcamlDir)/.dir
+ $(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
+ $(Verb) $(Archive.EXE) $@ $<
+endif
endif
##===- Generate documentation ---------------------------------------------===##
@@ -325,7 +387,10 @@ printcamlvars::
$(Echo) "LibraryCMA : " '$(LibraryCMA)'
$(Echo) "LibraryCMXA : " '$(LibraryCMXA)'
$(Echo) "OcamlSources1: " '$(OcamlSources1)'
+ $(Echo) "OcamlSources2: " '$(OcamlSources2)'
$(Echo) "OcamlSources : " '$(OcamlSources)'
+ $(Echo) "OcamlHeaders1: " '$(OcamlHeaders1)'
+ $(Echo) "OcamlHeaders2: " '$(OcamlHeaders2)'
$(Echo) "OcamlHeaders : " '$(OcamlHeaders)'
$(Echo) "ObjectsCMI : " '$(ObjectsCMI)'
$(Echo) "ObjectsCMO : " '$(ObjectsCMO)'
@@ -340,4 +405,6 @@ printcamlvars::
.PHONY: printcamlvars build-cmis \
clean-a clean-cmis clean-cma clean-cmxa \
install-a install-cmis install-cma install-cmxa \
- uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa
+ install-exe \
+ uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa \
+ uninstall-exe
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index e801c49471..7ab6f51efb 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -90,13 +90,13 @@ module Attribute = struct
| Optsize
| Ssp
| Sspreq
- | Alignment
+ | Alignment of int
| Nocapture
| Noredzone
| Noimplicitfloat
| Naked
| Inlinehint
- | Stackalignment
+ | Stackalignment of int
end
module Icmp = struct
@@ -170,6 +170,8 @@ external delete_type_name : string -> llmodule -> unit
external type_by_name : llmodule -> string -> lltype option
= "llvm_type_by_name"
external dump_module : llmodule -> unit = "llvm_dump_module"
+external set_module_inline_asm : llmodule -> string -> unit
+ = "llvm_set_module_inline_asm"
(*===-- Types -------------------------------------------------------------===*)
external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
@@ -548,10 +550,42 @@ let rec fold_right_function_range f i e init =
let fold_right_functions f m init =
fold_right_function_range f (function_end m) (At_start m) init
-external add_function_attr : llvalue -> Attribute.t -> unit
- = "llvm_add_function_attr"
-external remove_function_attr : llvalue -> Attribute.t -> unit
- = "llvm_remove_function_attr"
+external llvm_add_function_attr : llvalue -> int -> unit
+ = "llvm_add_function_attr"
+external llvm_remove_function_attr : llvalue -> int -> unit
+ = "llvm_remove_function_attr"
+
+let pack_attr (attr:Attribute.t) : int =
+ match attr with
+ Attribute.Zext -> 1 lsl 0
+ | Attribute.Sext -> 1 lsl 1
+ | Attribute.Noreturn -> 1 lsl 2
+ | Attribute.Inreg -> 1 lsl 3
+ | Attribute.Structret -> 1 lsl 4
+ | Attribute.Nounwind -> 1 lsl 5
+ | Attribute.Noalias -> 1 lsl 6
+ | Attribute.Byval -> 1 lsl 7
+ | Attribute.Nest -> 1 lsl 8
+ | Attribute.Readnone -> 1 lsl 9
+ | Attribute.Readonly -> 1 lsl 10
+ | Attribute.Noinline -> 1 lsl 11
+ | Attribute.Alwaysinline -> 1 lsl 12
+ | Attribute.Optsize -> 1 lsl 13
+ | Attribute.Ssp -> 1 lsl 14
+ | Attribute.Sspreq -> 1 lsl 15
+ | Attribute.Alignment n -> n lsl 16
+ | Attribute.Nocapture -> 1 lsl 21
+ | Attribute.Noredzone -> 1 lsl 22
+ | Attribute.Noimplicitfloat -> 1 lsl 23
+ | Attribute.Naked -> 1 lsl 24
+ | Attribute.Inlinehint -> 1 lsl 25
+ | Attribute.Stackalignment n -> n lsl 26
+
+let add_function_attr llval attr =
+ llvm_add_function_attr llval (pack_attr attr)
+
+let remove_function_attr llval attr =
+ llvm_remove_function_attr llval (pack_attr attr)
(*--... Operations on params ...............................................--*)
external params : llvalue -> llvalue array = "llvm_params"
@@ -602,10 +636,17 @@ let rec fold_right_param_range f init i e =
let fold_right_params f fn init =
fold_right_param_range f init (param_end fn) (At_start fn)
-external add_param_attr : llvalue -> Attribute.t -> unit
- = "llvm_add_param_attr"
-external remove_param_attr : llvalue -> Attribute.t -> unit
- = "llvm_remove_param_attr"
+external llvm_add_param_attr : llvalue -> int -> unit
+ = "llvm_add_param_attr"
+external llvm_remove_param_attr : llvalue -> int -> unit
+ = "llvm_remove_param_attr"
+
+let add_param_attr llval attr =
+ llvm_add_param_attr llval (pack_attr attr)
+
+let remove_param_attr llval attr =
+ llvm_remove_param_attr llval (pack_attr attr)
+
external set_param_alignment : llvalue -> int -> unit
= "llvm_set_param_alignment"
@@ -727,10 +768,17 @@ external instruction_call_conv: llvalue -> int
= "llvm_instruction_call_conv"
external set_instruction_call_conv: int -> llvalue -> unit
= "llvm_set_instruction_call_conv"
-external add_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
- = "llvm_add_instruction_param_attr"
-external remove_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
- = "llvm_remove_instruction_param_attr"
+
+external llvm_add_instruction_param_attr : llvalue -> int -> int -> unit
+ = "llvm_add_instruction_param_attr"
+external llvm_remove_instruction_param_attr : llvalue -> int -> int -> unit
+ = "llvm_remove_instruction_param_attr"
+
+let add_instruction_param_attr llval i attr =
+ llvm_add_instruction_param_attr llval i (pack_attr attr)
+
+let remove_instruction_param_attr llval i attr =
+ llvm_remove_instruction_param_attr llval i (pack_attr attr)
(*--... Operations on call instructions (only) .............................--*)
external is_tail_call : llvalue -> bool = "llvm_is_tail_call"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index 4b0c06da03..742265cd3d 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -139,13 +139,13 @@ module Attribute : sig
| Optsize
| Ssp
| Sspreq
- | Alignment
+ | Alignment of int
| Nocapture
| Noredzone
| Noimplicitfloat
| Naked
| Inlinehint
- | Stackalignment
+ | Stackalignment of int
end
(** The predicate for an integer comparison ([icmp]) instruction.
@@ -284,6 +284,11 @@ external type_by_name : llmodule -> string -> lltype option
error. See the method [llvm::Module::dump]. *)
external dump_module : llmodule -> unit = "llvm_dump_module"
+(** [set_module_inline_asm m asm] sets the inline assembler for the module. See
+ the method [llvm::Module::setModuleInlineAsm]. *)
+external set_module_inline_asm : llmodule -> string -> unit
+ = "llvm_set_module_inline_asm"
+
(** {6 Types} *)
@@ -1282,13 +1287,11 @@ external set_gc : string option -> llvalue -> unit = "llvm_set_gc"
(** [add_function_attr f a] adds attribute [a] to the return type of function
[f]. *)
-external add_function_attr : llvalue -> Attribute.t -> unit
- = "llvm_add_function_attr"
+val add_function_attr : llvalue -> Attribute.t -> unit
(** [remove_function_attr f a] removes attribute [a] from the return type of
function [f]. *)
-external remove_function_attr : llvalue -> Attribute.t -> unit
- = "llvm_remove_function_attr"
+val remove_function_attr : llvalue -> Attribute.t -> unit
(** {7 Operations on params} *)
@@ -1343,11 +1346,10 @@ val rev_iter_params : (llvalue -> unit) -> llvalue -> unit
val fold_right_params : (llvalue -> 'a -> 'a) -> llvalue -> 'a -> 'a
(** [add_param p a] adds attribute [a] to parameter [p]. *)
-external add_param_attr : llvalue -> Attribute.t -> unit = "llvm_add_param_attr"
+val add_param_attr : llvalue -> Attribute.t -> unit
(** [remove_param_attr p a] removes attribute [a] from parameter [p]. *)
-external remove_param_attr : llvalue -> Attribute.t -> unit
- = "llvm_remove_param_attr"
+val remove_param_attr : llvalue -> Attribute.t -> unit
(** [set_param_alignment p a] set the alignment of parameter [p] to [a]. *)
external set_param_alignment : llvalue -> int -> unit
@@ -1499,14 +1501,12 @@ external set_instruction_call_conv: int -> llvalue -> unit
(** [add_instruction_param_attr ci i a] adds attribute [a] to the [i]th
parameter of the call or invoke instruction [ci]. [i]=0 denotes the return
value. *)
-external add_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
- = "llvm_add_instruction_param_attr"
+val add_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
(** [remove_instruction_param_attr ci i a] removes attribute [a] from the
[i]th parameter of the call or invoke instruction [ci]. [i]=0 denotes the
return value. *)
-external remove_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
- = "llvm_remove_instruction_param_attr"
+val remove_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
(** {Operations on call instructions (only)} *)
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index d526a05a51..c4355ba2db 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -182,6 +182,11 @@ CAMLprim value llvm_dump_module(LLVMModuleRef M) {
return Val_unit;
}
+/* llmodule -> string -> unit */
+CAMLprim value llvm_set_module_inline_asm(LLVMModuleRef M, value Asm) {
+ LLVMSetModuleInlineAsm(M, String_val(Asm));
+ return Val_unit;
+}
/*===-- Types -------------------------------------------------------------===*/
@@ -941,13 +946,13 @@ CAMLprim value llvm_set_gc(value GC, LLVMValueRef Fn) {
/* llvalue -> Attribute.t -> unit */
CAMLprim value llvm_add_function_attr(LLVMValueRef Arg, value PA) {
- LLVMAddFunctionAttr(Arg, 1<<Int_val(PA));
+ LLVMAddFunctionAttr(Arg, Int_val(PA));
return Val_unit;
}
/* llvalue -> Attribute.t -> unit */
CAMLprim value llvm_remove_function_attr(LLVMValueRef Arg, value PA) {
- LLVMRemoveFunctionAttr(Arg, 1<<Int_val(PA));
+ LLVMRemoveFunctionAttr(Arg, Int_val(PA));
return Val_unit;
}
/*--... Operations on parameters ...........................................--*/
@@ -968,13 +973,13 @@ CAMLprim value llvm_params(LLVMValueRef Fn, value Index) {
/* llvalue -> Attribute.t -> unit */
CAMLprim value llvm_add_param_attr(LLVMValueRef Arg, value PA) {
- LLVMAddAttribute(Arg, 1<<Int_val(PA));
+ LLVMAddAttribute(Arg, Int_val(PA));
return Val_unit;
}
/* llvalue -> Attribute.t -> unit */
CAMLprim value llvm_remove_param_attr(LLVMValueRef Arg, value PA) {
- LLVMRemoveAttribute(Arg, 1<<Int_val(PA));
+ LLVMRemoveAttribute(Arg, Int_val(PA));
return Val_unit;
}
@@ -1042,7 +1047,7 @@ CAMLprim value llvm_set_instruction_call_conv(value CC, LLVMValueRef Inst) {
CAMLprim value llvm_add_instruction_param_attr(LLVMValueRef Instr,
value index,
value PA) {
- LLVMAddInstrAttribute(Instr, Int_val(index), 1<<Int_val(PA));
+ LLVMAddInstrAttribute(Instr, Int_val(index), Int_val(PA));
return Val_unit;
}
@@ -1050,7 +1055,7 @@ CAMLprim value llvm_add_instruction_param_attr(LLVMValueRef Instr,
CAMLprim value llvm_remove_instruction_param_attr(LLVMValueRef Instr,
value index,
value PA) {
- LLVMRemoveInstrAttribute(Instr, Int_val(index), 1<<Int_val(PA));
+ LLVMRemoveInstrAttribute(Instr, Int_val(index), Int_val(PA));
return Val_unit;
}