coldcc works better

* Only use Cold Calling Convention on x86
 * Add the cold attribute to functions marked with coldcc
This commit is contained in:
Andrew Kelley
2017-02-06 13:50:19 -05:00
parent 07a71fc322
commit 573f3f8d48
4 changed files with 19 additions and 5 deletions

View File

@@ -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, "");