diff libinterp/corefcn/jit-typeinfo.cc @ 17031:38bcfd413db0

Handle LLVM API incoherence. Octave now works with LLVM 3.0, 3.1, and 3.2 * configure.ac: Call LLVM API incoherence checks. * jit-typeinfo.cc: Check new defines. * pt-jit.cc: Check new defines. * m4/acinclude.m4: Add LLVM API incoherence checks.
author LYH <lyh.kernel@gmail.com>
date Wed, 01 May 2013 17:54:56 +0800
parents 68fc671a9339
children 36fd98b9ce48
line wrap: on
line diff
--- a/libinterp/corefcn/jit-typeinfo.cc	Sun Jul 21 17:26:39 2013 -0400
+++ b/libinterp/corefcn/jit-typeinfo.cc	Wed May 01 17:54:56 2013 +0800
@@ -41,7 +41,11 @@
 #include <llvm/Function.h>
 #include <llvm/Instructions.h>
 #include <llvm/Intrinsics.h>
+#ifdef IRBUILDER_HEADER_IN_SUPPORT_DIR
 #include <llvm/Support/IRBuilder.h>
+#else
+#include <llvm/IRBuilder.h>
+#endif
 #include <llvm/Support/raw_os_ostream.h>
 
 #include "jit-ir.h"
@@ -579,10 +583,23 @@
                                           aname, module);
 
   if (sret ())
-    llvm_function->addAttribute (1, llvm::Attribute::StructRet);
+    {
+#ifdef FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES
+      llvm::AttrBuilder attr_builder;
+      attr_builder.addAttribute (llvm::Attributes::StructRet);
+      llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder);
+      llvm_function->addAttribute (1, attrs);
+#else
+      llvm_function->addAttribute (1, llvm::Attribute::StructRet);
+#endif
+    }
 
   if (call_conv == jit_convention::internal)
+#ifdef FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES
+    llvm_function->addFnAttr (llvm::Attributes::AlwaysInline);
+#else
     llvm_function->addFnAttr (llvm::Attribute::AlwaysInline);
+#endif
 }
 
 jit_function::jit_function (const jit_function& fn, jit_type *aresult,
@@ -685,7 +702,14 @@
 
   if (sret ())
     {
+#ifdef CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES
+      llvm::AttrBuilder attr_builder;
+      attr_builder.addAttribute(llvm::Attributes::StructRet);
+      llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder); 
+      callinst->addAttribute (1, attrs);
+#else
       callinst->addAttribute (1, llvm::Attribute::StructRet);
+#endif
       ret = builder.CreateLoad (sret_mem);
     }