mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Merge branch 'master' into merge-2.067
This commit is contained in:
commit
7159aa5392
4 changed files with 38 additions and 12 deletions
|
@ -110,8 +110,16 @@ static void codegenModule(llvm::TargetMachine &Target, llvm::Module& m,
|
||||||
Target.addAnalysisPasses(Passes);
|
Target.addAnalysisPasses(Passes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LDC_LLVM_VER < 307
|
||||||
llvm::formatted_raw_ostream fout(out);
|
llvm::formatted_raw_ostream fout(out);
|
||||||
if (Target.addPassesToEmitFile(Passes, fout, fileType, codeGenOptLevel()))
|
#endif
|
||||||
|
if (Target.addPassesToEmitFile(Passes,
|
||||||
|
#if LDC_LLVM_VER >= 307
|
||||||
|
out,
|
||||||
|
#else
|
||||||
|
fout,
|
||||||
|
#endif
|
||||||
|
fileType, codeGenOptLevel()))
|
||||||
llvm_unreachable("no support for asm output");
|
llvm_unreachable("no support for asm output");
|
||||||
|
|
||||||
Passes.run(m);
|
Passes.run(m);
|
||||||
|
@ -178,19 +186,21 @@ namespace
|
||||||
static MDNode* FindSubprogram(const Function *F, DebugInfoFinder &Finder)
|
static MDNode* FindSubprogram(const Function *F, DebugInfoFinder &Finder)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if LDC_LLVM_VER >= 305
|
#if LDC_LLVM_VER >= 307
|
||||||
for (DISubprogram Subprogram : Finder.subprograms()) {
|
for (DISubprogram Subprogram : Finder.subprograms())
|
||||||
|
if (Subprogram->describes(F)) return Subprogram;
|
||||||
|
return nullptr;
|
||||||
|
#elif LDC_LLVM_VER >= 305
|
||||||
|
for (DISubprogram Subprogram : Finder.subprograms())
|
||||||
|
if (Subprogram.describes(F)) return Subprogram;
|
||||||
|
return nullptr;
|
||||||
#else
|
#else
|
||||||
for (DebugInfoFinder::iterator I = Finder.subprogram_begin(),
|
for (DebugInfoFinder::iterator I = Finder.subprogram_begin(),
|
||||||
E = Finder.subprogram_end();
|
E = Finder.subprogram_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
DISubprogram Subprogram(*I);
|
DISubprogram Subprogram(*I);
|
||||||
#endif
|
|
||||||
if (Subprogram.describes(F)) return Subprogram;
|
if (Subprogram.describes(F)) return Subprogram;
|
||||||
}
|
}
|
||||||
#if LDC_LLVM_VER >= 305
|
|
||||||
return nullptr;
|
|
||||||
#else
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -209,8 +219,12 @@ namespace
|
||||||
if (MDNode* N = FindSubprogram(F, Finder))
|
if (MDNode* N = FindSubprogram(F, Finder))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#if LDC_LLVM_VER >= 307
|
||||||
|
return N->getDisplayName();
|
||||||
|
#else
|
||||||
llvm::DISubprogram sub(N);
|
llvm::DISubprogram sub(N);
|
||||||
return sub.getDisplayName();
|
return sub.getDisplayName();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -267,7 +281,11 @@ namespace
|
||||||
os.PadToColumn(50);
|
os.PadToColumn(50);
|
||||||
os << ";";
|
os << ";";
|
||||||
}
|
}
|
||||||
|
#if LDC_LLVM_VER >= 307
|
||||||
|
os << " [debug variable = " << Var->getName() << ']';
|
||||||
|
#else
|
||||||
os << " [debug variable = " << Var.getName() << ']';
|
os << " [debug variable = " << Var.getName() << ']';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (const DbgValueInst* DVI = dyn_cast<DbgValueInst>(instr))
|
else if (const DbgValueInst* DVI = dyn_cast<DbgValueInst>(instr))
|
||||||
{
|
{
|
||||||
|
@ -277,7 +295,11 @@ namespace
|
||||||
os.PadToColumn(50);
|
os.PadToColumn(50);
|
||||||
os << ";";
|
os << ";";
|
||||||
}
|
}
|
||||||
|
#if LDC_LLVM_VER >= 307
|
||||||
|
os << " [debug variable = " << Var->getName() << ']';
|
||||||
|
#else
|
||||||
os << " [debug variable = " << Var.getName() << ']';
|
os << " [debug variable = " << Var.getName() << ']';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (const CallInst* callinstr = dyn_cast<CallInst>(instr))
|
else if (const CallInst* callinstr = dyn_cast<CallInst>(instr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1532,11 +1532,15 @@ size_t realignOffset(size_t offset, Type* type)
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Type * stripModifiers( Type * type )
|
Type * stripModifiers(Type * type, bool transitive)
|
||||||
{
|
{
|
||||||
if (type->ty == Tfunction)
|
if (type->ty == Tfunction)
|
||||||
return type;
|
return type;
|
||||||
return type->castMod(0);
|
|
||||||
|
if (transitive)
|
||||||
|
return type->unqualify(MODimmutable | MODconst | MODwild);
|
||||||
|
else
|
||||||
|
return type->castMod(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -199,7 +199,7 @@ LLFunctionType* DtoExtractFunctionType(LLType* type);
|
||||||
///
|
///
|
||||||
DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* arguments, LLValue* retvar = 0);
|
DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* arguments, LLValue* retvar = 0);
|
||||||
|
|
||||||
Type* stripModifiers(Type* type);
|
Type* stripModifiers(Type* type, bool transitive = false);
|
||||||
|
|
||||||
void printLabelName(std::ostream& target, const char* func_mangle, const char* label_name);
|
void printLabelName(std::ostream& target, const char* func_mangle, const char* label_name);
|
||||||
|
|
||||||
|
|
|
@ -494,8 +494,8 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||||
// repaint the type if necessary
|
// repaint the type if necessary
|
||||||
if (resulttype)
|
if (resulttype)
|
||||||
{
|
{
|
||||||
Type* rbase = stripModifiers(resulttype->toBasetype());
|
Type* rbase = stripModifiers(resulttype->toBasetype(), true);
|
||||||
Type* nextbase = stripModifiers(tf->nextOf()->toBasetype());
|
Type* nextbase = stripModifiers(tf->nextOf()->toBasetype(), true);
|
||||||
if (!rbase->equals(nextbase))
|
if (!rbase->equals(nextbase))
|
||||||
{
|
{
|
||||||
IF_LOG Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars());
|
IF_LOG Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue