Merge branch 'master' into merge-2.067

This commit is contained in:
Kai Nacke 2015-06-04 16:24:31 +02:00
commit fe2b9d445d
6 changed files with 40 additions and 14 deletions

View file

@ -504,7 +504,9 @@ llvm::TargetMachine* createTargetMachine(
#endif #endif
llvm::TargetOptions targetOptions; llvm::TargetOptions targetOptions;
#if LDC_LLVM_VER < 307
targetOptions.NoFramePointerElim = noFramePointerElim; targetOptions.NoFramePointerElim = noFramePointerElim;
#endif
#if LDC_LLVM_VER >= 307 #if LDC_LLVM_VER >= 307
targetOptions.MCOptions.ABIName = getABI(triple); targetOptions.MCOptions.ABIName = getABI(triple);
#endif #endif

View file

@ -787,6 +787,7 @@ void ldc::DIBuilder::EmitFuncEnd(FuncDeclaration *fd)
LOG_SCOPE; LOG_SCOPE;
assert(static_cast<llvm::MDNode *>(getIrFunc(fd)->diSubprogram) != 0); assert(static_cast<llvm::MDNode *>(getIrFunc(fd)->diSubprogram) != 0);
EmitStopPoint(fd->endloc.linnum);
} }
void ldc::DIBuilder::EmitBlockStart(Loc& loc) void ldc::DIBuilder::EmitBlockStart(Loc& loc)
@ -856,10 +857,11 @@ void ldc::DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd)
} }
void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd, void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
Type *type, bool isArtificial,
#if LDC_LLVM_VER >= 306 #if LDC_LLVM_VER >= 306
llvm::ArrayRef<int64_t> addr llvm::ArrayRef<int64_t> addr
#else #else
llvm::ArrayRef<llvm::Value *> addr llvm::ArrayRef<llvm::Value *> addr
#endif #endif
) )
{ {
@ -875,7 +877,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
return; // ensure that the debug variable is created only once return; // ensure that the debug variable is created only once
// get type description // 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) if (static_cast<llvm::MDNode *>(TD) == 0)
return; // unsupported return; // unsupported
@ -900,7 +902,8 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
CreateFile(vd->loc), // file CreateFile(vd->loc), // file
vd->loc.linnum, // line num vd->loc.linnum, // line num
TD, // type TD, // type
true // preserve true, // preserve
isArtificial ? llvm::dwarf::DW_AT_artificial : 0
); );
#if LDC_LLVM_VER < 306 #if LDC_LLVM_VER < 306
} }

View file

@ -165,8 +165,12 @@ public:
/// \brief Emits all things necessary for making debug info for a local variable vd. /// \brief Emits all things necessary for making debug info for a local variable vd.
/// \param ll LLVM Value of the variable. /// \param ll LLVM Value of the variable.
/// \param vd Variable declaration to emit debug info for. /// \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. /// \param addr An array of complex address operations.
void EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd, void EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
Type *type = 0,
bool isArtificial = false,
#if LDC_LLVM_VER >= 306 #if LDC_LLVM_VER >= 306
llvm::ArrayRef<int64_t> addr = llvm::ArrayRef<int64_t>() llvm::ArrayRef<int64_t> addr = llvm::ArrayRef<int64_t>()
#else #else

View file

@ -948,7 +948,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
assert(getIrParameter(fd->vthis)->value == thisvar); assert(getIrParameter(fd->vthis)->value == thisvar);
getIrParameter(fd->vthis)->value = thismem; getIrParameter(fd->vthis)->value = thismem;
gIR->DBuilder.EmitLocalVariable(thismem, fd->vthis); gIR->DBuilder.EmitLocalVariable(thismem, fd->vthis, 0, true);
} }
// give the 'nestArg' storage // give the 'nestArg' storage
@ -977,7 +977,8 @@ void DtoDefineFunction(FuncDeclaration* fd)
bool refout = vd->storage_class & (STCref | STCout); bool refout = vd->storage_class & (STCref | STCout);
bool lazy = vd->storage_class & STClazy; 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 // alloca a stack slot for this first class value arg
LLValue* mem = DtoAlloca(irparam->arg->type, vd->ident->toChars()); 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) 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);
} }
} }

View file

@ -169,7 +169,7 @@ DValue* DtoNestedVariable(Loc& loc, Type* astype, VarDeclaration* vd, bool byref
} }
if (dwarfValue && global.params.symdebug) 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); return new DVarValue(astype, vd, val);
} }
@ -507,7 +507,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
LLSmallVector<LLValue*, 2> addr; LLSmallVector<LLValue*, 2> addr;
#endif #endif
gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex); gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex);
gIR->DBuilder.EmitLocalVariable(frame, vd, addr); gIR->DBuilder.EmitLocalVariable(frame, vd, 0, false, addr);
} }
} }
} }

View file

@ -85,8 +85,13 @@ string dtype(Record* rec)
string attributes(ListInit* propertyList) string attributes(ListInit* propertyList)
{ {
string prop = propertyList->getSize() ? string prop =
propertyList->getElementAsRecord(0)->getName() : ""; #if LDC_LLVM_VER >= 307
propertyList->size()
#else
propertyList->getSize()
#endif
? propertyList->getElementAsRecord(0)->getName() : "";
return return
prop == "IntrNoMem" ? "nothrow pure @safe" : prop == "IntrNoMem" ? "nothrow pure @safe" :
@ -111,7 +116,13 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
ListInit* paramsList = rec.getValueAsListInit("ParamTypes"); ListInit* paramsList = rec.getValueAsListInit("ParamTypes");
vector<string> params; 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)); string t = dtype(paramsList->getElementAsRecord(i));
if(t == "") if(t == "")
@ -122,9 +133,14 @@ void processRecord(raw_ostream& os, Record& rec, string arch)
ListInit* retList = rec.getValueAsListInit("RetTypes"); ListInit* retList = rec.getValueAsListInit("RetTypes");
string ret; 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"; ret = "void";
else if(retList->getSize() == 1) else if(sz == 1)
{ {
ret = dtype(retList->getElementAsRecord(0)); ret = dtype(retList->getElementAsRecord(0));
if(ret == "") if(ret == "")