diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-02-06 13:50:19 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-02-06 13:50:19 -0500 |
| commit | 573f3f8d487dfd1f56ab71b96ad23af1a2d4162e (patch) | |
| tree | 53b6492aa6c417fa16cc1c590c6238111c00e0b7 /src/zig_llvm.cpp | |
| parent | 07a71fc3221dfba05caea5a50ebe3dac5c76d643 (diff) | |
| download | zig-573f3f8d487dfd1f56ab71b96ad23af1a2d4162e.tar.gz zig-573f3f8d487dfd1f56ab71b96ad23af1a2d4162e.zip | |
coldcc works better
* Only use Cold Calling Convention on x86
* Add the cold attribute to functions marked with coldcc
Diffstat (limited to 'src/zig_llvm.cpp')
| -rw-r--r-- | src/zig_llvm.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index d6c32b01b2..c59a533a05 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -561,6 +561,14 @@ void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const ch func->setAttributes(new_attr_set); } +void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn_ref) { + Function *func = unwrap<Function>(fn_ref); + const AttributeSet attr_set = func->getAttributes(); + const AttributeSet new_attr_set = attr_set.addAttribute(func->getContext(), AttributeSet::FunctionIndex, + Attribute::Cold); + func->setAttributes(new_attr_set); +} + static_assert((Triple::ArchType)ZigLLVM_LastArchType == Triple::LastArchType, ""); static_assert((Triple::VendorType)ZigLLVM_LastVendorType == Triple::LastVendorType, ""); |
