Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
17030:05b8ad3b7d12 | 17031:38bcfd413db0 |
---|---|
39 #include <llvm/ExecutionEngine/ExecutionEngine.h> | 39 #include <llvm/ExecutionEngine/ExecutionEngine.h> |
40 #include <llvm/LLVMContext.h> | 40 #include <llvm/LLVMContext.h> |
41 #include <llvm/Function.h> | 41 #include <llvm/Function.h> |
42 #include <llvm/Instructions.h> | 42 #include <llvm/Instructions.h> |
43 #include <llvm/Intrinsics.h> | 43 #include <llvm/Intrinsics.h> |
44 #ifdef IRBUILDER_HEADER_IN_SUPPORT_DIR | |
44 #include <llvm/Support/IRBuilder.h> | 45 #include <llvm/Support/IRBuilder.h> |
46 #else | |
47 #include <llvm/IRBuilder.h> | |
48 #endif | |
45 #include <llvm/Support/raw_os_ostream.h> | 49 #include <llvm/Support/raw_os_ostream.h> |
46 | 50 |
47 #include "jit-ir.h" | 51 #include "jit-ir.h" |
48 #include "ov.h" | 52 #include "ov.h" |
49 #include "ov-builtin.h" | 53 #include "ov-builtin.h" |
577 llvm::FunctionType *ft = llvm::FunctionType::get (rtype, llvm_args, false); | 581 llvm::FunctionType *ft = llvm::FunctionType::get (rtype, llvm_args, false); |
578 llvm_function = llvm::Function::Create (ft, llvm::Function::ExternalLinkage, | 582 llvm_function = llvm::Function::Create (ft, llvm::Function::ExternalLinkage, |
579 aname, module); | 583 aname, module); |
580 | 584 |
581 if (sret ()) | 585 if (sret ()) |
582 llvm_function->addAttribute (1, llvm::Attribute::StructRet); | 586 { |
587 #ifdef FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES | |
588 llvm::AttrBuilder attr_builder; | |
589 attr_builder.addAttribute (llvm::Attributes::StructRet); | |
590 llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder); | |
591 llvm_function->addAttribute (1, attrs); | |
592 #else | |
593 llvm_function->addAttribute (1, llvm::Attribute::StructRet); | |
594 #endif | |
595 } | |
583 | 596 |
584 if (call_conv == jit_convention::internal) | 597 if (call_conv == jit_convention::internal) |
598 #ifdef FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES | |
599 llvm_function->addFnAttr (llvm::Attributes::AlwaysInline); | |
600 #else | |
585 llvm_function->addFnAttr (llvm::Attribute::AlwaysInline); | 601 llvm_function->addFnAttr (llvm::Attribute::AlwaysInline); |
602 #endif | |
586 } | 603 } |
587 | 604 |
588 jit_function::jit_function (const jit_function& fn, jit_type *aresult, | 605 jit_function::jit_function (const jit_function& fn, jit_type *aresult, |
589 const std::vector<jit_type *>& aargs) | 606 const std::vector<jit_type *>& aargs) |
590 : module (fn.module), llvm_function (fn.llvm_function), mresult (aresult), | 607 : module (fn.module), llvm_function (fn.llvm_function), mresult (aresult), |
683 llvm::CallInst *callinst = builder.CreateCall (llvm_function, llvm_args); | 700 llvm::CallInst *callinst = builder.CreateCall (llvm_function, llvm_args); |
684 llvm::Value *ret = callinst; | 701 llvm::Value *ret = callinst; |
685 | 702 |
686 if (sret ()) | 703 if (sret ()) |
687 { | 704 { |
705 #ifdef CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES | |
706 llvm::AttrBuilder attr_builder; | |
707 attr_builder.addAttribute(llvm::Attributes::StructRet); | |
708 llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder); | |
709 callinst->addAttribute (1, attrs); | |
710 #else | |
688 callinst->addAttribute (1, llvm::Attribute::StructRet); | 711 callinst->addAttribute (1, llvm::Attribute::StructRet); |
712 #endif | |
689 ret = builder.CreateLoad (sret_mem); | 713 ret = builder.CreateLoad (sret_mem); |
690 } | 714 } |
691 | 715 |
692 if (mresult) | 716 if (mresult) |
693 { | 717 { |