mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 07:00:46 +03:00
Merge branch 'merge-2.064' into merge-2.065
Conflicts: runtime/druntime
This commit is contained in:
commit
f8a53ab3dc
16 changed files with 187 additions and 46 deletions
|
@ -19,7 +19,9 @@
|
|||
#include <set>
|
||||
#include <map>
|
||||
#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"
|
||||
#else
|
||||
#include "llvm/Analysis/DebugInfo.h"
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
#include "gen/optimizer.h"
|
||||
#include "gen/programs.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/Linker/Linker.h"
|
||||
#else
|
||||
#include "llvm/Linker.h"
|
||||
#endif
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Program.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
#include "gen/optimizer.h"
|
||||
#include "gen/passes/Passes.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"
|
||||
#endif
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/ManagedStatic.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
|
||||
/// and other target specific options with VersionCondition.
|
||||
static void registerPredefinedTargetVersions() {
|
||||
|
@ -748,6 +779,8 @@ int main(int argc, char **argv)
|
|||
llvm::InitializeAllAsmPrinters();
|
||||
llvm::InitializeAllAsmParsers();
|
||||
|
||||
initializePasses();
|
||||
|
||||
bool helpOnly;
|
||||
Strings files;
|
||||
parseCommandLine(argc, argv, files, helpOnly);
|
||||
|
|
|
@ -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.
|
||||
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())
|
||||
Passes.add(new DataLayout(*DL));
|
||||
else
|
||||
|
@ -136,7 +141,13 @@ void writeModule(llvm::Module* m, std::string filename)
|
|||
llvm::sys::path::replace_extension(bcpath, global.bc_ext);
|
||||
Logger::println("Writing LLVM bitcode to: %s\n", bcpath.c_str());
|
||||
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())
|
||||
{
|
||||
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);
|
||||
Logger::println("Writing LLVM asm to: %s\n", llpath.c_str());
|
||||
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())
|
||||
{
|
||||
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());
|
||||
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())
|
||||
{
|
||||
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());
|
||||
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())
|
||||
{
|
||||
codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_ObjectFile);
|
||||
|
|
|
@ -664,6 +664,9 @@ void ldc::DIBuilder::EmitBlockStart(Loc loc)
|
|||
CreateFile(loc), // file
|
||||
loc.linnum, // line
|
||||
0 // column
|
||||
#if LDC_LLVM_VER >= 305
|
||||
, 0 // DWARF path discriminator value
|
||||
#endif
|
||||
);
|
||||
IR->func()->diLexicalBlocks.push(block);
|
||||
EmitStopPoint(loc.linnum);
|
||||
|
|
|
@ -14,8 +14,13 @@
|
|||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Type.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/DIBuilder.h"
|
||||
#endif
|
||||
#else
|
||||
#if LDC_LLVM_VER == 302
|
||||
#include "llvm/DataLayout.h"
|
||||
|
|
|
@ -29,13 +29,21 @@
|
|||
#include "gen/pragma.h"
|
||||
#include "gen/runtime.h"
|
||||
#include "gen/tollvm.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/Linker/Linker.h"
|
||||
#else
|
||||
#include "llvm/Linker.h"
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#else
|
||||
#include "llvm/Intrinsics.h"
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/CFG.h"
|
||||
#else
|
||||
#include "llvm/Support/CFG.h"
|
||||
#endif
|
||||
#include <iostream>
|
||||
|
||||
#if LDC_LLVM_VER == 302
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#else
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#endif
|
||||
|
||||
namespace llvm {
|
||||
class LLVMContext;
|
||||
|
|
|
@ -31,7 +31,11 @@
|
|||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#else
|
||||
#include "llvm/DebugInfo.h"
|
||||
#endif
|
||||
#else
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
|
@ -57,7 +61,11 @@
|
|||
|
||||
#include "gen/llvmcompat.h"
|
||||
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#else
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#endif
|
||||
|
||||
using llvm::IRBuilder;
|
||||
|
||||
|
|
|
@ -34,11 +34,16 @@
|
|||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/LegacyPassNameParser.h"
|
||||
#else
|
||||
#include "llvm/Support/PassNameParser.h"
|
||||
#endif
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
|
||||
extern llvm::TargetMachine* gTargetMachine;
|
||||
using namespace llvm;
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
// per-module passes we are about to build.
|
||||
PassManager mpm;
|
||||
|
||||
// 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.
|
||||
if (disableSimplifyLibCalls)
|
||||
|
@ -321,19 +326,31 @@ bool ldc_optimize_module(llvm::Module* m)
|
|||
|
||||
mpm.add(tli);
|
||||
|
||||
// Add an appropriate TargetData instance for this module.
|
||||
#if LDC_LLVM_VER >= 302
|
||||
mpm.add(new DataLayout(m));
|
||||
// Add an appropriate DataLayout instance for this module.
|
||||
#if LDC_LLVM_VER >= 305
|
||||
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
|
||||
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
|
||||
|
||||
// Also set up a manager for the per-function passes.
|
||||
FunctionPassManager fpm(m);
|
||||
#if LDC_LLVM_VER >= 302
|
||||
fpm.add(new DataLayout(m));
|
||||
FunctionPassManager fpm(M);
|
||||
#if LDC_LLVM_VER >= 305
|
||||
fpm.add(new DataLayoutPass(M));
|
||||
gTargetMachine->addAnalysisPasses(fpm);
|
||||
#elif LDC_LLVM_VER >= 302
|
||||
fpm.add(new DataLayout(M));
|
||||
#else
|
||||
fpm.add(new TargetData(m));
|
||||
fpm.add(new TargetData(M));
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
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.doFinalization();
|
||||
|
||||
// Run per-module passes.
|
||||
mpm.run(*m);
|
||||
mpm.run(*M);
|
||||
|
||||
// Verify the resulting module.
|
||||
verifyModule(m);
|
||||
verifyModule(M);
|
||||
|
||||
// Report that we run some passes.
|
||||
return true;
|
||||
|
|
|
@ -38,7 +38,11 @@
|
|||
#include "llvm/Target/TargetData.h"
|
||||
#endif
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#else
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#endif
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Analysis/CallGraph.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
|
@ -74,7 +78,7 @@ SizeLimit("dgc2stack-size-limit", cl::init(1024), cl::Hidden,
|
|||
|
||||
namespace {
|
||||
struct Analysis {
|
||||
DataLayout& DL;
|
||||
const DataLayout& DL;
|
||||
const Module& M;
|
||||
CallGraph* CG;
|
||||
CallGraphNode* CGNode;
|
||||
|
@ -394,17 +398,14 @@ namespace {
|
|||
bool runOnFunction(Function &F);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<DataLayout>();
|
||||
#if LDC_LLVM_VER >= 305
|
||||
AU.addRequired<DominatorTreeWrapperPass>();
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
AU.addRequired<DominatorTreeWrapperPass>();
|
||||
AU.addPreserved<CallGraphWrapperPass>();
|
||||
#else
|
||||
AU.addRequired<DominatorTree>();
|
||||
#endif
|
||||
|
||||
#if LDC_LLVM_VER >= 305
|
||||
AU.addPreserved<CallGraphWrapperPass>();
|
||||
#else
|
||||
AU.addPreserved<CallGraph>();
|
||||
AU.addRequired<DataLayout>();
|
||||
AU.addRequired<DominatorTree>();
|
||||
AU.addPreserved<CallGraph>();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -462,19 +463,19 @@ static bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& D
|
|||
bool GarbageCollect2Stack::runOnFunction(Function &F) {
|
||||
DEBUG(errs() << "\nRunning -dgc2stack on function " << F.getName() << '\n');
|
||||
|
||||
DataLayout& DL = getAnalysis<DataLayout>();
|
||||
#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();
|
||||
CallGraphWrapperPass *CGPass = getAnalysisIfAvailable<CallGraphWrapperPass>();
|
||||
CallGraph *CG = CGPass ? &CGPass->getCallGraph() : 0;
|
||||
#else
|
||||
DominatorTree& DT = getAnalysis<DominatorTree>();
|
||||
DataLayout &DL = getAnalysis<DataLayout>();
|
||||
DominatorTree &DT = getAnalysis<DominatorTree>();
|
||||
CallGraph *CG = getAnalysisIfAvailable<CallGraph>();
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 305
|
||||
CallGraphWrapperPass* CGPass = getAnalysisIfAvailable<CallGraphWrapperPass>();
|
||||
CallGraph* CG = CGPass ? &CGPass->getCallGraph() : 0;
|
||||
#else
|
||||
CallGraph* CG = getAnalysisIfAvailable<CallGraph>();
|
||||
#endif
|
||||
CallGraphNode* CGNode = CG ? (*CG)[&F] : NULL;
|
||||
CallGraphNode *CGNode = CG ? (*CG)[&F] : NULL;
|
||||
|
||||
Analysis A = { DL, *M, CG, CGNode };
|
||||
|
||||
|
@ -789,7 +790,11 @@ bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& DT,
|
|||
|
||||
for (Value::use_iterator UI = V->use_begin(), UE = V->use_end();
|
||||
UI != UE; ++UI) {
|
||||
#if LDC_LLVM_VER >= 305
|
||||
Use *U = &(*UI);
|
||||
#else
|
||||
Use *U = &UI.getUse();
|
||||
#endif
|
||||
Visited.insert(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.
|
||||
for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end();
|
||||
UI != UE; ++UI) {
|
||||
#if LDC_LLVM_VER >= 305
|
||||
Use *U = &(*UI);
|
||||
#else
|
||||
Use *U = &UI.getUse();
|
||||
#endif
|
||||
if (Visited.insert(U))
|
||||
Worklist.push_back(U);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace {
|
|||
class LLVM_LIBRARY_VISIBILITY LibCallOptimization {
|
||||
protected:
|
||||
Function *Caller;
|
||||
bool* Changed;
|
||||
bool *Changed;
|
||||
const DataLayout *DL;
|
||||
AliasAnalysis *AA;
|
||||
LLVMContext *Context;
|
||||
|
@ -85,11 +85,11 @@ namespace {
|
|||
/// delete CI.
|
||||
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) {
|
||||
Caller = CI->getParent()->getParent();
|
||||
this->Changed = &Changed;
|
||||
this->DL = &DL;
|
||||
this->DL = DL;
|
||||
this->AA = &AA;
|
||||
if (CI->getCalledFunction())
|
||||
Context = &CI->getCalledFunction()->getContext();
|
||||
|
@ -300,10 +300,14 @@ namespace {
|
|||
void InitOptimizations();
|
||||
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 {
|
||||
#if LDC_LLVM_VER >= 305
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
#else
|
||||
AU.addRequired<DataLayout>();
|
||||
#endif
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
}
|
||||
};
|
||||
|
@ -353,7 +357,12 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
|
|||
if (Optimizations.empty())
|
||||
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>();
|
||||
|
||||
// Iterate to catch opportunities opened up by other optimizations,
|
||||
|
@ -371,7 +380,7 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
|
|||
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());
|
||||
|
||||
bool Changed = false;
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
#include "ir/irfunction.h"
|
||||
#include "ir/irlandingpad.h"
|
||||
#include "ir/irmodule.h"
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#include "llvm/IR/CFG.h"
|
||||
#else
|
||||
#include "llvm/Support/CFG.h"
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#else
|
||||
|
|
|
@ -1029,7 +1029,11 @@ DValue* CallExp::toElem(IRState* p)
|
|||
LLValue* ptr = exp1->toElem(p)->getRVal();
|
||||
LLValue* cmp = exp2->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));
|
||||
#endif
|
||||
return new DImValue(exp3->type, ret);
|
||||
// atomicrmw instruction
|
||||
} else if (fndecl->llvmInternal == LLVMatomic_rmw) {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
#include "ir/irtype.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"
|
||||
#else
|
||||
#include "llvm/Analysis/DebugInfo.h"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bcbc6a00fe639499a511597f1bc8d8bb40a9d39e
|
||||
Subproject commit 7b3ebf9bd67a41bc757fce5484cf38a40568340e
|
Loading…
Add table
Add a link
Reference in a new issue