Fix build with LLVM top-of-tree

This commit is contained in:
Matt Pharr
2012-10-17 11:01:13 -07:00
parent 406fbab40e
commit 172a189c6f
8 changed files with 204 additions and 25 deletions

View File

@@ -48,6 +48,9 @@
#include <math.h>
#include <stdlib.h>
#include <llvm/LLVMContext.h>
#if !defined(LLVM_3_0) && !defined(LLVM_3_1)
#include <llvm/Attributes.h>
#endif
#include <llvm/Module.h>
#include <llvm/Type.h>
#include <llvm/DerivedTypes.h>
@@ -697,7 +700,11 @@ lDefineConstantIntFunc(const char *name, int val, llvm::Module *module,
llvm::Function *func = module->getFunction(name);
Assert(func != NULL); // it should be declared already...
#if defined(LLVM_3_0) || defined(LLVM_3_1)
func->addFnAttr(llvm::Attribute::AlwaysInline);
#else
func->addFnAttr(llvm::Attributes::AlwaysInline);
#endif
llvm::BasicBlock *bblock = llvm::BasicBlock::Create(*g->ctx, "entry", func, 0);
llvm::ReturnInst::Create(*g->ctx, LLVMInt32(val), bblock);