aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-02 22:00:42 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-03 00:29:27 -0400
commitf1bd02e6f46821415d96f54f6a3258159ba5a9c5 (patch)
treeb9ccd45ba8b9aa047ae2ba4dc071f219167a2aa9 /src/codegen.cpp
parentc180ef86afee17e36135b653fb6256cff46f4e69 (diff)
downloadzig-f1bd02e6f46821415d96f54f6a3258159ba5a9c5.tar.gz
zig-f1bd02e6f46821415d96f54f6a3258159ba5a9c5.zip
add @setAlignStack builtin
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 18d19e39f0..6a0e7e12f4 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -410,6 +410,9 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) {
addLLVMFnAttr(fn_table_entry->llvm_value, "noinline");
break;
case FnInlineAuto:
+ if (fn_table_entry->alignstack_value != 0) {
+ addLLVMFnAttr(fn_table_entry->llvm_value, "noinline");
+ }
break;
}
@@ -452,10 +455,8 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) {
}
}
- if (g->zig_target.os == ZigLLVM_Win32 && g->zig_target.arch.arch == ZigLLVM_x86_64 &&
- fn_type->data.fn.fn_type_id.cc != CallingConventionNaked)
- {
- addLLVMFnAttrInt(fn_table_entry->llvm_value, "alignstack", 16);
+ if (fn_table_entry->alignstack_value != 0) {
+ addLLVMFnAttrInt(fn_table_entry->llvm_value, "alignstack", fn_table_entry->alignstack_value);
}
addLLVMFnAttr(fn_table_entry->llvm_value, "nounwind");
@@ -3379,6 +3380,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdSetEvalBranchQuota:
case IrInstructionIdPtrTypeOf:
case IrInstructionIdOpaqueType:
+ case IrInstructionIdSetAlignStack:
zig_unreachable();
case IrInstructionIdReturn:
return ir_render_return(g, executable, (IrInstructionReturn *)instruction);
@@ -4784,6 +4786,7 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdSetEvalBranchQuota, "setEvalBranchQuota", 1);
create_builtin_fn(g, BuiltinFnIdAlignCast, "alignCast", 2);
create_builtin_fn(g, BuiltinFnIdOpaqueType, "OpaqueType", 0);
+ create_builtin_fn(g, BuiltinFnIdSetAlignStack, "setAlignStack", 1);
}
static const char *bool_to_str(bool b) {