Add Builder::array_alloca.
This commit is contained in:
parent
9f0168a9f3
commit
cd0476a390
2 changed files with 24 additions and 0 deletions
|
|
@ -445,6 +445,25 @@ impl Builder<'a, 'll, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn array_alloca(&self,
|
||||
ty: &'ll Type,
|
||||
len: &'ll Value,
|
||||
name: &str,
|
||||
align: Align) -> &'ll Value {
|
||||
self.count_insn("alloca");
|
||||
unsafe {
|
||||
let alloca = if name.is_empty() {
|
||||
llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len, noname())
|
||||
} else {
|
||||
let name = SmallCStr::new(name);
|
||||
llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len,
|
||||
name.as_ptr())
|
||||
};
|
||||
llvm::LLVMSetAlignment(alloca, align.abi() as c_uint);
|
||||
alloca
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load(&self, ptr: &'ll Value, align: Align) -> &'ll Value {
|
||||
self.count_insn("load");
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -875,6 +875,11 @@ extern "C" {
|
|||
|
||||
// Memory
|
||||
pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
|
||||
pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
|
||||
Ty: &'a Type,
|
||||
Val: &'a Value,
|
||||
Name: *const c_char)
|
||||
-> &'a Value;
|
||||
pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
|
||||
|
||||
pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue