Skip to content

Commit

Permalink
[OCaml] Documentation
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193967 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
whitequark committed Nov 4, 2013
1 parent 8a3bdd6 commit 6b84161
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
23 changes: 17 additions & 6 deletions bindings/ocaml/llvm/llvm.mli
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ module CallConv : sig
convention from C. *)
end

(** The attribute kind of a function parameter, result or the function itself.
See [llvm::Attribute::AttrKind]. *)
module Attribute : sig
type t =
| Zext
Expand Down Expand Up @@ -633,6 +635,7 @@ val type_by_name : llmodule -> string -> lltype option
See the method [llvm::Value::getType]. *)
val type_of : llvalue -> lltype

(** [classify_value v] returns the kind of the value [v]. *)
val classify_value : llvalue -> ValueKind.t

(** [value_name v] returns the name of the value [v]. For global values, this is
Expand Down Expand Up @@ -732,6 +735,8 @@ val is_null : llvalue -> bool
otherwise. Similar to [llvm::isa<UndefValue>]. *)
val is_undef : llvalue -> bool

(** [constexpr_opcode v] returns an [Opcode.t] corresponding to constexpr
value [v], or [Opcode.Invalid] if [v] is not a constexpr. *)
val constexpr_opcode : llvalue -> Opcode.t


Expand Down Expand Up @@ -771,7 +776,7 @@ val mdnode : llcontext -> llvalue array -> llvalue
See the method [llvm::MDString::getString] *)
val get_mdstring : llvalue -> string option

(** [get_named_metadata m name] return all the MDNodes belonging to the named
(** [get_named_metadata m name] returns all the MDNodes belonging to the named
metadata (if any).
See the method [llvm::NamedMDNode::getOperand]. *)
val get_named_metadata : llmodule -> string -> llvalue array
Expand Down Expand Up @@ -1578,10 +1583,11 @@ val fold_left_blocks : ('a -> llbasicblock -> 'a) -> 'a -> llvalue -> 'a
See the method [llvm::Function::end]. *)
val block_end : llvalue -> (llvalue, llbasicblock) llrev_pos

(** [block_pred gv] returns the function list position preceding [After gv].
(** [block_pred bb] returns the basic block list position preceding [After bb].
See the method [llvm::Function::iterator::operator--]. *)
val block_pred : llbasicblock -> (llvalue, llbasicblock) llrev_pos

(** [block_terminator bb] returns the terminator of the basic block [bb]. *)
val block_terminator : llbasicblock -> llvalue option

(** [rev_iter_blocks f fn] applies function [f] to each of the basic blocks
Expand Down Expand Up @@ -1610,6 +1616,10 @@ val block_of_value : llvalue -> llbasicblock
See the method [llvm::Instruction::getParent]. *)
val instr_parent : llvalue -> llbasicblock

(** [delete_instruction i] deletes the instruction [i].
* See the method [llvm::Instruction::eraseFromParent]. *)
val delete_instruction : llvalue -> unit

(** [instr_begin bb] returns the first position in the instruction list of the
basic block [bb]. [instr_begin] and [instr_succ] can be used to iterate over
the instruction list in order.
Expand Down Expand Up @@ -1642,8 +1652,12 @@ val instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
[f1,...,fN] are the instructions of basic block [bb]. Tail recursive. *)
val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a

(** [inst_opcode i] returns the [Opcode.t] corresponding to instruction [i],
or [Opcode.Invalid] if [i] is not an instruction. *)
val instr_opcode : llvalue -> Opcode.t

(** [icmp_predicate i] returns the [Icmp.t] corresponding to an [icmp]
instruction [i]. *)
val icmp_predicate : llvalue -> Icmp.t option


Expand Down Expand Up @@ -1673,7 +1687,7 @@ val add_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
val remove_instruction_param_attr : llvalue -> int -> Attribute.t -> unit


(** {Operations on call instructions (only)} *)
(** {7 Operations on call instructions (only)} *)

(** [is_tail_call ci] is [true] if the call instruction [ci] is flagged as
eligible for tail call optimization, [false] otherwise.
Expand Down Expand Up @@ -1711,9 +1725,6 @@ val add_incoming : (llvalue * llbasicblock) -> llvalue -> unit
See the method [llvm::PHINode::getIncomingValue]. *)
val incoming : llvalue -> (llvalue * llbasicblock) list

(** [delete_instruction i] deletes the instruction [i].
* See the method [llvm::Instruction::eraseFromParent]. *)
val delete_instruction : llvalue -> unit


(** {6 Instruction builders} *)
Expand Down
3 changes: 2 additions & 1 deletion bindings/ocaml/llvm/llvm_ocaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ CAMLprim value llvm_get_mdstring(LLVMValueRef V) {
CAMLreturn(Val_int(0));
}

/* llmodule -> string -> llvalue array */
CAMLprim value llvm_get_namedmd(LLVMModuleRef M, value Name)
{
CAMLparam1(Name);
Expand Down Expand Up @@ -1268,7 +1269,7 @@ CAMLprim value llvm_instr_get_opcode(LLVMValueRef Inst) {
return Val_int(o);
}

/* llvalue -> ICmp.t */
/* llvalue -> ICmp.t option */
CAMLprim value llvm_instr_icmp_predicate(LLVMValueRef Val) {
CAMLparam0();
int x = LLVMGetICmpPredicate(Val);
Expand Down

0 comments on commit 6b84161

Please sign in to comment.