mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Add changes for LLVM 3.2.
This commit is contained in:
parent
bf2aaaca84
commit
dbb5a34eda
7 changed files with 34 additions and 1 deletions
|
@ -19,8 +19,12 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
#include <llvm/DebugInfo.h>
|
||||||
|
#else
|
||||||
#include <llvm/Analysis/DebugInfo.h>
|
#include <llvm/Analysis/DebugInfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dsymbol.h"
|
#include "dsymbol.h"
|
||||||
#include "lexer.h"
|
#include "lexer.h"
|
||||||
|
|
|
@ -159,8 +159,16 @@ void VarDeclaration::codegen(Ir* p)
|
||||||
LLType *_type = DtoConstInitializerType(type, init);
|
LLType *_type = DtoConstInitializerType(type, init);
|
||||||
|
|
||||||
// create the global variable
|
// create the global variable
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
// FIXME: clang uses a command line option for the thread model
|
||||||
|
LLGlobalVariable* gvar = new LLGlobalVariable(*gIR->module, _type, _isconst,
|
||||||
|
DtoLinkage(this), NULL, _name, 0,
|
||||||
|
isThreadlocal() ? LLGlobalVariable::GeneralDynamicTLSModel
|
||||||
|
: LLGlobalVariable::NotThreadLocal);
|
||||||
|
#else
|
||||||
LLGlobalVariable* gvar = new LLGlobalVariable(*gIR->module, _type, _isconst,
|
LLGlobalVariable* gvar = new LLGlobalVariable(*gIR->module, _type, _isconst,
|
||||||
DtoLinkage(this), NULL, _name, 0, isThreadlocal());
|
DtoLinkage(this), NULL, _name, 0, isThreadlocal());
|
||||||
|
#endif
|
||||||
this->ir.irGlobal->value = gvar;
|
this->ir.irGlobal->value = gvar;
|
||||||
|
|
||||||
// set the alignment
|
// set the alignment
|
||||||
|
|
|
@ -455,7 +455,11 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(llvm::ArrayRef<llvm::AttributeWithIndex>(attrs));
|
||||||
|
#else
|
||||||
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(attrs.begin(), attrs.end());
|
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(attrs.begin(), attrs.end());
|
||||||
|
#endif
|
||||||
func->setAttributes(attrlist);
|
func->setAttributes(attrlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
#include "ir/irstruct.h"
|
#include "ir/irstruct.h"
|
||||||
#include "ir/irvar.h"
|
#include "ir/irvar.h"
|
||||||
|
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
#include "llvm/DIBuilder.h"
|
||||||
|
#else
|
||||||
#include "llvm/Analysis/DIBuilder.h"
|
#include "llvm/Analysis/DIBuilder.h"
|
||||||
|
#endif
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
|
@ -14,11 +14,16 @@
|
||||||
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
|
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
#include "llvm/DebugInfo.h"
|
||||||
|
#include "llvm/IRBuilder.h"
|
||||||
|
#else
|
||||||
#include "llvm/Analysis/DebugInfo.h"
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
|
#include "llvm/Support/IRBuilder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
|
||||||
#include "llvm/Support/IRBuilder.h"
|
|
||||||
using llvm::IRBuilder;
|
using llvm::IRBuilder;
|
||||||
|
|
||||||
// for WriteTypeSymbolic
|
// for WriteTypeSymbolic
|
||||||
|
|
|
@ -21,7 +21,11 @@
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Intrinsics.h"
|
#include "llvm/Intrinsics.h"
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
#include "llvm/IRBuilder.h"
|
||||||
|
#else
|
||||||
#include "llvm/Support/IRBuilder.h"
|
#include "llvm/Support/IRBuilder.h"
|
||||||
|
#endif
|
||||||
#include "llvm/Analysis/AliasAnalysis.h"
|
#include "llvm/Analysis/AliasAnalysis.h"
|
||||||
#include "llvm/Analysis/ValueTracking.h"
|
#include "llvm/Analysis/ValueTracking.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
|
|
|
@ -674,7 +674,11 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||||
}
|
}
|
||||||
|
|
||||||
// set calling convention and parameter attributes
|
// set calling convention and parameter attributes
|
||||||
|
#if LDC_LLVM_VER >= 302
|
||||||
|
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(llvm::ArrayRef<llvm::AttributeWithIndex>(attrs));
|
||||||
|
#else
|
||||||
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(attrs.begin(), attrs.end());
|
llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(attrs.begin(), attrs.end());
|
||||||
|
#endif
|
||||||
if (dfnval && dfnval->func)
|
if (dfnval && dfnval->func)
|
||||||
{
|
{
|
||||||
LLFunction* llfunc = llvm::dyn_cast<LLFunction>(dfnval->val);
|
LLFunction* llfunc = llvm::dyn_cast<LLFunction>(dfnval->val);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue