Merge branch 'merge-2.064' into merge-2.065

Conflicts:
	runtime/druntime
This commit is contained in:
kai 2014-03-12 18:27:43 +01:00
commit f8a53ab3dc
16 changed files with 187 additions and 46 deletions

View file

@ -19,7 +19,9 @@
#include <set> #include <set>
#include <map> #include <map>
#include <string> #include <string>
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 305
#include "llvm/IR/DebugInfo.h"
#elif LDC_LLVM_VER >= 302
#include "llvm/DebugInfo.h" #include "llvm/DebugInfo.h"
#else #else
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"

View file

@ -18,7 +18,11 @@
#include "gen/optimizer.h" #include "gen/optimizer.h"
#include "gen/programs.h" #include "gen/programs.h"
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#if LDC_LLVM_VER >= 305
#include "llvm/Linker/Linker.h"
#else
#include "llvm/Linker.h" #include "llvm/Linker.h"
#endif
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h" #include "llvm/Support/Program.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"

View file

@ -32,7 +32,15 @@
#include "gen/optimizer.h" #include "gen/optimizer.h"
#include "gen/passes/Passes.h" #include "gen/passes/Passes.h"
#include "gen/runtime.h" #include "gen/runtime.h"
#if LDC_LLVM_VER >= 304
#include "llvm/InitializePasses.h"
#endif
#include "llvm/LinkAllPasses.h"
#if LDC_LLVM_VER >= 305
#include "llvm/Linker/Linker.h"
#else
#include "llvm/Linker.h" #include "llvm/Linker.h"
#endif
#include "llvm/Support/Host.h" #include "llvm/Support/Host.h"
#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
@ -464,6 +472,29 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles, bool &
} }
} }
static void initializePasses() {
#if LDC_LLVM_VER >= 304
using namespace llvm;
// Initialize passes
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeCore(Registry);
initializeDebugIRPass(Registry);
initializeScalarOpts(Registry);
initializeObjCARCOpts(Registry);
initializeVectorization(Registry);
initializeIPO(Registry);
initializeAnalysis(Registry);
initializeIPA(Registry);
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
initializeInstrumentation(Registry);
initializeTarget(Registry);
// For codegen passes, only passes that do IR to IR transformation are
// supported. For now, just add CodeGenPrepare.
initializeCodeGenPreparePass(Registry);
#endif
}
/// Registers the predefined versions specific to the current target triple /// Registers the predefined versions specific to the current target triple
/// and other target specific options with VersionCondition. /// and other target specific options with VersionCondition.
static void registerPredefinedTargetVersions() { static void registerPredefinedTargetVersions() {
@ -748,6 +779,8 @@ int main(int argc, char **argv)
llvm::InitializeAllAsmPrinters(); llvm::InitializeAllAsmPrinters();
llvm::InitializeAllAsmParsers(); llvm::InitializeAllAsmParsers();
initializePasses();
bool helpOnly; bool helpOnly;
Strings files; Strings files;
parseCommandLine(argc, argv, files, helpOnly); parseCommandLine(argc, argv, files, helpOnly);

View file

@ -60,7 +60,12 @@ static void codegenModule(llvm::TargetMachine &Target, llvm::Module& m,
// Build up all of the passes that we want to do to the module. // Build up all of the passes that we want to do to the module.
FunctionPassManager Passes(&m); FunctionPassManager Passes(&m);
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 305
if (const DataLayout *DL = Target.getDataLayout())
Passes.add(new DataLayoutPass(*DL));
else
Passes.add(new DataLayoutPass(&m));
#elif LDC_LLVM_VER >= 302
if (const DataLayout *DL = Target.getDataLayout()) if (const DataLayout *DL = Target.getDataLayout())
Passes.add(new DataLayout(*DL)); Passes.add(new DataLayout(*DL));
else else
@ -136,7 +141,13 @@ void writeModule(llvm::Module* m, std::string filename)
llvm::sys::path::replace_extension(bcpath, global.bc_ext); llvm::sys::path::replace_extension(bcpath, global.bc_ext);
Logger::println("Writing LLVM bitcode to: %s\n", bcpath.c_str()); Logger::println("Writing LLVM bitcode to: %s\n", bcpath.c_str());
std::string errinfo; std::string errinfo;
llvm::raw_fd_ostream bos(bcpath.c_str(), errinfo, llvm::sys::fs::F_Binary); llvm::raw_fd_ostream bos(bcpath.c_str(), errinfo,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (bos.has_error()) if (bos.has_error())
{ {
error(Loc(), "cannot write LLVM bitcode file '%s': %s", bcpath.c_str(), errinfo.c_str()); error(Loc(), "cannot write LLVM bitcode file '%s': %s", bcpath.c_str(), errinfo.c_str());
@ -151,7 +162,13 @@ void writeModule(llvm::Module* m, std::string filename)
llvm::sys::path::replace_extension(llpath, global.ll_ext); llvm::sys::path::replace_extension(llpath, global.ll_ext);
Logger::println("Writing LLVM asm to: %s\n", llpath.c_str()); Logger::println("Writing LLVM asm to: %s\n", llpath.c_str());
std::string errinfo; std::string errinfo;
llvm::raw_fd_ostream aos(llpath.c_str(), errinfo); llvm::raw_fd_ostream aos(llpath.c_str(), errinfo,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (aos.has_error()) if (aos.has_error())
{ {
error(Loc(), "cannot write LLVM asm file '%s': %s", llpath.c_str(), errinfo.c_str()); error(Loc(), "cannot write LLVM asm file '%s': %s", llpath.c_str(), errinfo.c_str());
@ -180,7 +197,13 @@ void writeModule(llvm::Module* m, std::string filename)
Logger::println("Writing native asm to: %s\n", spath.c_str()); Logger::println("Writing native asm to: %s\n", spath.c_str());
std::string err; std::string err;
{ {
llvm::raw_fd_ostream out(spath.c_str(), err); llvm::raw_fd_ostream out(spath.c_str(), err,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (err.empty()) if (err.empty())
{ {
codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_AssemblyFile); codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_AssemblyFile);
@ -210,7 +233,13 @@ void writeModule(llvm::Module* m, std::string filename)
Logger::println("Writing object file to: %s\n", objpath.c_str()); Logger::println("Writing object file to: %s\n", objpath.c_str());
std::string err; std::string err;
{ {
llvm::raw_fd_ostream out(objpath.c_str(), err, llvm::sys::fs::F_Binary); llvm::raw_fd_ostream out(objpath.c_str(), err,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (err.empty()) if (err.empty())
{ {
codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_ObjectFile); codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_ObjectFile);

View file

@ -664,6 +664,9 @@ void ldc::DIBuilder::EmitBlockStart(Loc loc)
CreateFile(loc), // file CreateFile(loc), // file
loc.linnum, // line loc.linnum, // line
0 // column 0 // column
#if LDC_LLVM_VER >= 305
, 0 // DWARF path discriminator value
#endif
); );
IR->func()->diLexicalBlocks.push(block); IR->func()->diLexicalBlocks.push(block);
EmitStopPoint(loc.linnum); EmitStopPoint(loc.linnum);

View file

@ -14,8 +14,13 @@
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/Type.h" #include "llvm/IR/Type.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#if LDC_LLVM_VER >= 305
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DIBuilder.h"
#else
#include "llvm/DebugInfo.h" #include "llvm/DebugInfo.h"
#include "llvm/DIBuilder.h" #include "llvm/DIBuilder.h"
#endif
#else #else
#if LDC_LLVM_VER == 302 #if LDC_LLVM_VER == 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"

View file

@ -29,13 +29,21 @@
#include "gen/pragma.h" #include "gen/pragma.h"
#include "gen/runtime.h" #include "gen/runtime.h"
#include "gen/tollvm.h" #include "gen/tollvm.h"
#if LDC_LLVM_VER >= 305
#include "llvm/Linker/Linker.h"
#else
#include "llvm/Linker.h" #include "llvm/Linker.h"
#endif
#if LDC_LLVM_VER >= 303 #if LDC_LLVM_VER >= 303
#include "llvm/IR/Intrinsics.h" #include "llvm/IR/Intrinsics.h"
#else #else
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
#endif #endif
#if LDC_LLVM_VER >= 305
#include "llvm/IR/CFG.h"
#else
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#endif
#include <iostream> #include <iostream>
#if LDC_LLVM_VER == 302 #if LDC_LLVM_VER == 302

View file

@ -26,7 +26,11 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#if LDC_LLVM_VER >= 305
#include "llvm/IR/CallSite.h"
#else
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#endif
namespace llvm { namespace llvm {
class LLVMContext; class LLVMContext;

View file

@ -31,7 +31,11 @@
#include "llvm/IR/Attributes.h" #include "llvm/IR/Attributes.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#if LDC_LLVM_VER >= 305
#include "llvm/IR/DebugInfo.h"
#else
#include "llvm/DebugInfo.h" #include "llvm/DebugInfo.h"
#endif
#else #else
#include "llvm/Type.h" #include "llvm/Type.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
@ -57,7 +61,11 @@
#include "gen/llvmcompat.h" #include "gen/llvmcompat.h"
#if LDC_LLVM_VER >= 305
#include "llvm/IR/CallSite.h"
#else
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#endif
using llvm::IRBuilder; using llvm::IRBuilder;

View file

@ -34,11 +34,16 @@
#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#if LDC_LLVM_VER >= 305
#include "llvm/IR/LegacyPassNameParser.h"
#else
#include "llvm/Support/PassNameParser.h" #include "llvm/Support/PassNameParser.h"
#endif
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h"
extern llvm::TargetMachine* gTargetMachine;
using namespace llvm; using namespace llvm;
// Allow the user to specify specific optimizations to run. // Allow the user to specify specific optimizations to run.
@ -306,14 +311,14 @@ static void addOptimizationPasses(PassManagerBase &mpm, FunctionPassManager &fpm
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// This function runs optimization passes based on command line arguments. // This function runs optimization passes based on command line arguments.
// Returns true if any optimization passes were invoked. // Returns true if any optimization passes were invoked.
bool ldc_optimize_module(llvm::Module* m) bool ldc_optimize_module(llvm::Module *M)
{ {
// Create a PassManager to hold and optimize the collection of // Create a PassManager to hold and optimize the collection of
// per-module passes we are about to build. // per-module passes we are about to build.
PassManager mpm; PassManager mpm;
// Add an appropriate TargetLibraryInfo pass for the module's triple. // Add an appropriate TargetLibraryInfo pass for the module's triple.
TargetLibraryInfo *tli = new TargetLibraryInfo(Triple(m->getTargetTriple())); TargetLibraryInfo *tli = new TargetLibraryInfo(Triple(M->getTargetTriple()));
// The -disable-simplify-libcalls flag actually disables all builtin optzns. // The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (disableSimplifyLibCalls) if (disableSimplifyLibCalls)
@ -321,19 +326,31 @@ bool ldc_optimize_module(llvm::Module* m)
mpm.add(tli); mpm.add(tli);
// Add an appropriate TargetData instance for this module. // Add an appropriate DataLayout instance for this module.
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 305
mpm.add(new DataLayout(m)); const DataLayout *DL = M->getDataLayout();
assert(DL && "DataLayout not set at module");
mpm.add(new DataLayoutPass(*DL));
#elif LDC_LLVM_VER >= 302
mpm.add(new DataLayout(M));
#else #else
mpm.add(new TargetData(m)); mpm.add(new TargetData(M));
#endif
#if LDC_LLVM_VER >= 305
// Add internal analysis passes from the target machine.
gTargetMachine->addAnalysisPasses(mpm);
#endif #endif
// Also set up a manager for the per-function passes. // Also set up a manager for the per-function passes.
FunctionPassManager fpm(m); FunctionPassManager fpm(M);
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 305
fpm.add(new DataLayout(m)); fpm.add(new DataLayoutPass(M));
gTargetMachine->addAnalysisPasses(fpm);
#elif LDC_LLVM_VER >= 302
fpm.add(new DataLayout(M));
#else #else
fpm.add(new TargetData(m)); fpm.add(new TargetData(M));
#endif #endif
// If the -strip-debug command line option was specified, add it before // If the -strip-debug command line option was specified, add it before
@ -372,15 +389,15 @@ bool ldc_optimize_module(llvm::Module* m)
// Run per-function passes. // Run per-function passes.
fpm.doInitialization(); fpm.doInitialization();
for (llvm::Module::iterator F = m->begin(), E = m->end(); F != E; ++F) for (llvm::Module::iterator F = M->begin(), E = M->end(); F != E; ++F)
fpm.run(*F); fpm.run(*F);
fpm.doFinalization(); fpm.doFinalization();
// Run per-module passes. // Run per-module passes.
mpm.run(*m); mpm.run(*M);
// Verify the resulting module. // Verify the resulting module.
verifyModule(m); verifyModule(M);
// Report that we run some passes. // Report that we run some passes.
return true; return true;

View file

@ -38,7 +38,11 @@
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#endif #endif
#endif #endif
#if LDC_LLVM_VER >= 305
#include "llvm/IR/CallSite.h"
#else
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#endif
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CallGraph.h"
#if LDC_LLVM_VER >= 305 #if LDC_LLVM_VER >= 305
@ -74,7 +78,7 @@ SizeLimit("dgc2stack-size-limit", cl::init(1024), cl::Hidden,
namespace { namespace {
struct Analysis { struct Analysis {
DataLayout& DL; const DataLayout& DL;
const Module& M; const Module& M;
CallGraph* CG; CallGraph* CG;
CallGraphNode* CGNode; CallGraphNode* CGNode;
@ -394,16 +398,13 @@ namespace {
bool runOnFunction(Function &F); bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DataLayout>();
#if LDC_LLVM_VER >= 305 #if LDC_LLVM_VER >= 305
AU.addRequired<DataLayoutPass>();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
#else
AU.addRequired<DominatorTree>();
#endif
#if LDC_LLVM_VER >= 305
AU.addPreserved<CallGraphWrapperPass>(); AU.addPreserved<CallGraphWrapperPass>();
#else #else
AU.addRequired<DataLayout>();
AU.addRequired<DominatorTree>();
AU.addPreserved<CallGraph>(); AU.addPreserved<CallGraph>();
#endif #endif
} }
@ -462,16 +463,16 @@ static bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& D
bool GarbageCollect2Stack::runOnFunction(Function &F) { bool GarbageCollect2Stack::runOnFunction(Function &F) {
DEBUG(errs() << "\nRunning -dgc2stack on function " << F.getName() << '\n'); DEBUG(errs() << "\nRunning -dgc2stack on function " << F.getName() << '\n');
DataLayout& DL = getAnalysis<DataLayout>();
#if LDC_LLVM_VER >= 305 #if LDC_LLVM_VER >= 305
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
assert(DLP && "required DataLayoutPass is null");
const DataLayout &DL = DLP->getDataLayout();
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
#else
DominatorTree& DT = getAnalysis<DominatorTree>();
#endif
#if LDC_LLVM_VER >= 305
CallGraphWrapperPass *CGPass = getAnalysisIfAvailable<CallGraphWrapperPass>(); CallGraphWrapperPass *CGPass = getAnalysisIfAvailable<CallGraphWrapperPass>();
CallGraph *CG = CGPass ? &CGPass->getCallGraph() : 0; CallGraph *CG = CGPass ? &CGPass->getCallGraph() : 0;
#else #else
DataLayout &DL = getAnalysis<DataLayout>();
DominatorTree &DT = getAnalysis<DominatorTree>();
CallGraph *CG = getAnalysisIfAvailable<CallGraph>(); CallGraph *CG = getAnalysisIfAvailable<CallGraph>();
#endif #endif
CallGraphNode *CGNode = CG ? (*CG)[&F] : NULL; CallGraphNode *CGNode = CG ? (*CG)[&F] : NULL;
@ -789,7 +790,11 @@ bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& DT,
for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); for (Value::use_iterator UI = V->use_begin(), UE = V->use_end();
UI != UE; ++UI) { UI != UE; ++UI) {
#if LDC_LLVM_VER >= 305
Use *U = &(*UI);
#else
Use *U = &UI.getUse(); Use *U = &UI.getUse();
#endif
Visited.insert(U); Visited.insert(U);
Worklist.push_back(U); Worklist.push_back(U);
} }
@ -865,7 +870,11 @@ bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& DT,
// The original value is not captured via this if the new value isn't. // The original value is not captured via this if the new value isn't.
for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end();
UI != UE; ++UI) { UI != UE; ++UI) {
#if LDC_LLVM_VER >= 305
Use *U = &(*UI);
#else
Use *U = &UI.getUse(); Use *U = &UI.getUse();
#endif
if (Visited.insert(U)) if (Visited.insert(U))
Worklist.push_back(U); Worklist.push_back(U);
} }

View file

@ -85,11 +85,11 @@ namespace {
/// delete CI. /// delete CI.
virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B)=0; virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B)=0;
Value *OptimizeCall(CallInst *CI, bool& Changed, const DataLayout &DL, Value *OptimizeCall(CallInst *CI, bool& Changed, const DataLayout *DL,
AliasAnalysis& AA, IRBuilder<> &B) { AliasAnalysis& AA, IRBuilder<> &B) {
Caller = CI->getParent()->getParent(); Caller = CI->getParent()->getParent();
this->Changed = &Changed; this->Changed = &Changed;
this->DL = &DL; this->DL = DL;
this->AA = &AA; this->AA = &AA;
if (CI->getCalledFunction()) if (CI->getCalledFunction())
Context = &CI->getCalledFunction()->getContext(); Context = &CI->getCalledFunction()->getContext();
@ -300,10 +300,14 @@ namespace {
void InitOptimizations(); void InitOptimizations();
bool runOnFunction(Function &F); bool runOnFunction(Function &F);
bool runOnce(Function &F, const DataLayout& DL, AliasAnalysis& AA); bool runOnce(Function &F, const DataLayout *DL, AliasAnalysis& AA);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
#if LDC_LLVM_VER >= 305
AU.addRequired<DataLayoutPass>();
#else
AU.addRequired<DataLayout>(); AU.addRequired<DataLayout>();
#endif
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
} }
}; };
@ -353,7 +357,12 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
if (Optimizations.empty()) if (Optimizations.empty())
InitOptimizations(); InitOptimizations();
const DataLayout &DL = getAnalysis<DataLayout>(); #if LDC_LLVM_VER >= 305
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
#else
const DataLayout *DL = &getAnalysis<DataLayout>();
#endif
AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
// Iterate to catch opportunities opened up by other optimizations, // Iterate to catch opportunities opened up by other optimizations,
@ -371,7 +380,7 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
return EverChanged; return EverChanged;
} }
bool SimplifyDRuntimeCalls::runOnce(Function &F, const DataLayout& DL, AliasAnalysis& AA) { bool SimplifyDRuntimeCalls::runOnce(Function &F, const DataLayout *DL, AliasAnalysis& AA) {
IRBuilder<> Builder(F.getContext()); IRBuilder<> Builder(F.getContext());
bool Changed = false; bool Changed = false;

View file

@ -24,7 +24,11 @@
#include "ir/irfunction.h" #include "ir/irfunction.h"
#include "ir/irlandingpad.h" #include "ir/irlandingpad.h"
#include "ir/irmodule.h" #include "ir/irmodule.h"
#if LDC_LLVM_VER >= 305
#include "llvm/IR/CFG.h"
#else
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#endif
#if LDC_LLVM_VER >= 303 #if LDC_LLVM_VER >= 303
#include "llvm/IR/InlineAsm.h" #include "llvm/IR/InlineAsm.h"
#else #else

View file

@ -1029,7 +1029,11 @@ DValue* CallExp::toElem(IRState* p)
LLValue* ptr = exp1->toElem(p)->getRVal(); LLValue* ptr = exp1->toElem(p)->getRVal();
LLValue* cmp = exp2->toElem(p)->getRVal(); LLValue* cmp = exp2->toElem(p)->getRVal();
LLValue* val = exp3->toElem(p)->getRVal(); LLValue* val = exp3->toElem(p)->getRVal();
#if LDC_LLVM_VER >= 305
LLValue* ret = gIR->ir->CreateAtomicCmpXchg(ptr, cmp, val, llvm::AtomicOrdering(atomicOrdering), llvm::AtomicOrdering(atomicOrdering));
#else
LLValue* ret = gIR->ir->CreateAtomicCmpXchg(ptr, cmp, val, llvm::AtomicOrdering(atomicOrdering)); LLValue* ret = gIR->ir->CreateAtomicCmpXchg(ptr, cmp, val, llvm::AtomicOrdering(atomicOrdering));
#endif
return new DImValue(exp3->type, ret); return new DImValue(exp3->type, ret);
// atomicrmw instruction // atomicrmw instruction
} else if (fndecl->llvmInternal == LLVMatomic_rmw) { } else if (fndecl->llvmInternal == LLVMatomic_rmw) {

View file

@ -12,7 +12,9 @@
#include "ir/irtype.h" #include "ir/irtype.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 305
#include "llvm/IR/DebugInfo.h"
#elif LDC_LLVM_VER >= 302
#include "llvm/DebugInfo.h" #include "llvm/DebugInfo.h"
#else #else
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"

@ -1 +1 @@
Subproject commit bcbc6a00fe639499a511597f1bc8d8bb40a9d39e Subproject commit 7b3ebf9bd67a41bc757fce5484cf38a40568340e