mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-26 07:25:00 -07:00
cast isize to unsigned int for llvm api, add defaulted name parameter to helper.
This commit is contained in:
@@ -459,7 +459,7 @@ void lb_set_entity_from_other_modules_linkage_correctly(lbModule *other_module,
|
||||
lbValue lb_expr_untyped_const_to_typed(lbModule *m, Ast *expr, Type *t);
|
||||
bool lb_is_expr_untyped_const(Ast *expr);
|
||||
|
||||
LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment);
|
||||
LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const* name = "");
|
||||
|
||||
void lb_mem_zero_ptr(lbProcedure *p, LLVMValueRef ptr, Type *type, unsigned alignment);
|
||||
|
||||
|
||||
@@ -216,9 +216,9 @@ LLVMValueRef llvm_one(lbModule *m) {
|
||||
return LLVMConstInt(lb_type(m, t_i32), 1, false);
|
||||
}
|
||||
|
||||
LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment) {
|
||||
LLVMValueRef val = LLVMBuildAlloca(p->builder, llvm_type, "");
|
||||
LLVMSetAlignment(val, alignment);
|
||||
LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const* name) {
|
||||
LLVMValueRef val = LLVMBuildAlloca(p->builder, llvm_type, name);
|
||||
LLVMSetAlignment(val, cast(unsigned int)alignment);
|
||||
LLVMPositionBuilderAtEnd(p->builder, p->curr_block->block);
|
||||
|
||||
return val;
|
||||
@@ -2655,7 +2655,7 @@ lbAddr lb_add_local(lbProcedure *p, Type *type, Entity *e, bool zero_init, i32 p
|
||||
alignment *= 2; // NOTE(bill): Just in case
|
||||
}
|
||||
|
||||
LLVMValueRef ptr = llvm_alloca(p, llvm_type, alignment);
|
||||
LLVMValueRef ptr = llvm_alloca(p, llvm_type, alignment, name);
|
||||
|
||||
if (!zero_init && !force_no_init) {
|
||||
// If there is any padding of any kind, just zero init regardless of zero_init parameter
|
||||
|
||||
Reference in New Issue
Block a user