}
if (length) {
- util_snprintf(name, size, "%s.v%u%c%u", name_root, length, c, width);
+ snprintf(name, size, "%s.v%u%c%u", name_root, length, c, width);
} else {
- util_snprintf(name, size, "%s.%c%u", name_root, c, width);
+ snprintf(name, size, "%s.%c%u", name_root, c, width);
}
}
{
switch (attr) {
case LP_FUNC_ATTR_ALWAYSINLINE: return LLVMAlwaysInlineAttribute;
- case LP_FUNC_ATTR_BYVAL: return LLVMByValAttribute;
case LP_FUNC_ATTR_INREG: return LLVMInRegAttribute;
case LP_FUNC_ATTR_NOALIAS: return LLVMNoAliasAttribute;
case LP_FUNC_ATTR_NOUNWIND: return LLVMNoUnwindAttribute;
{
switch (attr) {
case LP_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline";
- case LP_FUNC_ATTR_BYVAL: return "byval";
case LP_FUNC_ATTR_INREG: return "inreg";
case LP_FUNC_ATTR_NOALIAS: return "noalias";
case LP_FUNC_ATTR_NOUNWIND: return "nounwind";
case LP_FUNC_ATTR_READNONE: return "readnone";
case LP_FUNC_ATTR_READONLY: return "readonly";
+ case LP_FUNC_ATTR_WRITEONLY: return "writeonly";
+ case LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY: return "inaccessiblememonly";
+ case LP_FUNC_ATTR_CONVERGENT: return "convergent";
default:
_debug_printf("Unhandled function attribute: %x\n", attr);
return 0;
#if HAVE_LLVM < 0x0400
LLVMAttribute llvm_attr = lp_attr_to_llvm_attr(attr);
- if (attr_idx == -1) {
- LLVMAddFunctionAttr(function_or_call, llvm_attr);
+ if (LLVMIsAFunction(function_or_call)) {
+ if (attr_idx == -1) {
+ LLVMAddFunctionAttr(function_or_call, llvm_attr);
+ } else {
+ LLVMAddAttribute(LLVMGetParam(function_or_call, attr_idx - 1), llvm_attr);
+ }
} else {
- LLVMAddAttribute(LLVMGetParam(function_or_call, attr_idx - 1), llvm_attr);
+ LLVMAddInstrAttribute(function_or_call, attr_idx, llvm_attr);
}
#else
function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
+ /*
+ * If llvm removes an intrinsic we use, we'll hit this abort (rather
+ * than a call to address zero in the jited code).
+ */
+ if (LLVMGetIntrinsicID(function) == 0) {
+ _debug_printf("llvm (version 0x%x) found no intrinsic for %s, going to crash...\n",
+ HAVE_LLVM, name);
+ abort();
+ }
+
if (!set_callsite_attrs)
lp_add_func_attributes(function, attr_mask);