mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
Merge branch 'master' into merge-2.067
This commit is contained in:
commit
fe2b9d445d
6 changed files with 40 additions and 14 deletions
|
@ -504,7 +504,9 @@ llvm::TargetMachine* createTargetMachine(
|
|||
#endif
|
||||
|
||||
llvm::TargetOptions targetOptions;
|
||||
#if LDC_LLVM_VER < 307
|
||||
targetOptions.NoFramePointerElim = noFramePointerElim;
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 307
|
||||
targetOptions.MCOptions.ABIName = getABI(triple);
|
||||
#endif
|
||||
|
|
|
@ -787,6 +787,7 @@ void ldc::DIBuilder::EmitFuncEnd(FuncDeclaration *fd)
|
|||
LOG_SCOPE;
|
||||
|
||||
assert(static_cast<llvm::MDNode *>(getIrFunc(fd)->diSubprogram) != 0);
|
||||
EmitStopPoint(fd->endloc.linnum);
|
||||
}
|
||||
|
||||
void ldc::DIBuilder::EmitBlockStart(Loc& loc)
|
||||
|
@ -856,6 +857,7 @@ void ldc::DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd)
|
|||
}
|
||||
|
||||
void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
Type *type, bool isArtificial,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
llvm::ArrayRef<int64_t> addr
|
||||
#else
|
||||
|
@ -875,7 +877,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
|||
return; // ensure that the debug variable is created only once
|
||||
|
||||
// get type description
|
||||
ldc::DIType TD = CreateTypeDescription(vd->type, true);
|
||||
ldc::DIType TD = CreateTypeDescription(type ? type : vd->type, true);
|
||||
if (static_cast<llvm::MDNode *>(TD) == 0)
|
||||
return; // unsupported
|
||||
|
||||
|
@ -900,7 +902,8 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
|||
CreateFile(vd->loc), // file
|
||||
vd->loc.linnum, // line num
|
||||
TD, // type
|
||||
true // preserve
|
||||
true, // preserve
|
||||
isArtificial ? llvm::dwarf::DW_AT_artificial : 0
|
||||
);
|
||||
#if LDC_LLVM_VER < 306
|
||||
}
|
||||
|
|
|
@ -165,8 +165,12 @@ public:
|
|||
/// \brief Emits all things necessary for making debug info for a local variable vd.
|
||||
/// \param ll LLVM Value of the variable.
|
||||
/// \param vd Variable declaration to emit debug info for.
|
||||
/// \param type Type of parameter if diferent from vd->type
|
||||
/// \param isArtificial Parameter is artificial, e.g. this
|
||||
/// \param addr An array of complex address operations.
|
||||
void EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
||||
Type *type = 0,
|
||||
bool isArtificial = false,
|
||||
#if LDC_LLVM_VER >= 306
|
||||
llvm::ArrayRef<int64_t> addr = llvm::ArrayRef<int64_t>()
|
||||
#else
|
||||
|
|
|
@ -948,7 +948,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
assert(getIrParameter(fd->vthis)->value == thisvar);
|
||||
getIrParameter(fd->vthis)->value = thismem;
|
||||
|
||||
gIR->DBuilder.EmitLocalVariable(thismem, fd->vthis);
|
||||
gIR->DBuilder.EmitLocalVariable(thismem, fd->vthis, 0, true);
|
||||
}
|
||||
|
||||
// give the 'nestArg' storage
|
||||
|
@ -977,7 +977,8 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
|
||||
bool refout = vd->storage_class & (STCref | STCout);
|
||||
bool lazy = vd->storage_class & STClazy;
|
||||
if (!refout && (!irparam->arg->byref || lazy))
|
||||
bool firstClassVal = !refout && (!irparam->arg->byref || lazy);
|
||||
if (firstClassVal)
|
||||
{
|
||||
// alloca a stack slot for this first class value arg
|
||||
LLValue* mem = DtoAlloca(irparam->arg->type, vd->ident->toChars());
|
||||
|
@ -991,7 +992,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
}
|
||||
|
||||
if (global.params.symdebug && !(isaArgument(irparam->value) && isaArgument(irparam->value)->hasByValAttr()) && !refout)
|
||||
gIR->DBuilder.EmitLocalVariable(irparam->value, vd);
|
||||
gIR->DBuilder.EmitLocalVariable(irparam->value, vd, firstClassVal ? irparam->arg->type : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ DValue* DtoNestedVariable(Loc& loc, Type* astype, VarDeclaration* vd, bool byref
|
|||
}
|
||||
|
||||
if (dwarfValue && global.params.symdebug)
|
||||
gIR->DBuilder.EmitLocalVariable(dwarfValue, vd, dwarfAddr);
|
||||
gIR->DBuilder.EmitLocalVariable(dwarfValue, vd, 0, false, dwarfAddr);
|
||||
|
||||
return new DVarValue(astype, vd, val);
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
|
|||
LLSmallVector<LLValue*, 2> addr;
|
||||
#endif
|
||||
gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex);
|
||||
gIR->DBuilder.EmitLocalVariable(frame, vd, addr);
|
||||
gIR->DBuilder.EmitLocalVariable(frame, vd, 0, false, addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,13 @@ string dtype(Record* rec)
|
|||
|
||||
string attributes(ListInit* propertyList)
|
||||
{
|
||||
string prop = propertyList->getSize() ?
|
||||
propertyList->getElementAsRecord(0)->getName() : "";
|
||||
string prop =
|
||||
#if LDC_LLVM_VER >= 307
|
||||
propertyList->size()
|
||||
#else
|
||||
propertyList->getSize()
|
||||
#endif
|
||||
? propertyList->getElementAsRecord(0)->getName() : "";
|
||||
|
||||
return
|
||||
prop == "IntrNoMem" ? "nothrow pure @safe" :
|
||||
|
@ -111,7 +116,13 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
|
|||
|
||||
ListInit* paramsList = rec.getValueAsListInit("ParamTypes");
|
||||
vector<string> params;
|
||||
for(unsigned int i = 0; i < paramsList->getSize(); i++)
|
||||
for(unsigned int i = 0; i <
|
||||
#if LDC_LLVM_VER >= 307
|
||||
paramsList->size();
|
||||
#else
|
||||
paramsList->getSize();
|
||||
#endif
|
||||
i++)
|
||||
{
|
||||
string t = dtype(paramsList->getElementAsRecord(i));
|
||||
if(t == "")
|
||||
|
@ -122,9 +133,14 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
|
|||
|
||||
ListInit* retList = rec.getValueAsListInit("RetTypes");
|
||||
string ret;
|
||||
if(retList->getSize() == 0)
|
||||
#if LDC_LLVM_VER >= 307
|
||||
size_t sz = retList->size();
|
||||
#else
|
||||
size_t sz = retList->getSize();
|
||||
#endif
|
||||
if(sz == 0)
|
||||
ret = "void";
|
||||
else if(retList->getSize() == 1)
|
||||
else if(sz == 1)
|
||||
{
|
||||
ret = dtype(retList->getElementAsRecord(0));
|
||||
if(ret == "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue