mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 01:30:36 +00:00
Set DW_AT_artificial only if argument is marked as artificial.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95461 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e6373eb826
commit
b4645643de
@ -193,7 +193,9 @@ namespace llvm {
|
|||||||
FlagFwdDecl = 1 << 2,
|
FlagFwdDecl = 1 << 2,
|
||||||
FlagAppleBlock = 1 << 3,
|
FlagAppleBlock = 1 << 3,
|
||||||
FlagBlockByrefStruct = 1 << 4,
|
FlagBlockByrefStruct = 1 << 4,
|
||||||
FlagVirtual = 1 << 5
|
FlagVirtual = 1 << 5,
|
||||||
|
FlagArtificial = 1 << 6 // To identify artificial arguments in
|
||||||
|
// a subroutine type. e.g. "this" in c++.
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -241,6 +243,9 @@ namespace llvm {
|
|||||||
bool isVirtual() const {
|
bool isVirtual() const {
|
||||||
return (getFlags() & FlagVirtual) != 0;
|
return (getFlags() & FlagVirtual) != 0;
|
||||||
}
|
}
|
||||||
|
bool isArtificial() const {
|
||||||
|
return (getFlags() & FlagArtificial) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// dump - print type.
|
/// dump - print type.
|
||||||
void dump() const;
|
void dump() const;
|
||||||
@ -574,6 +579,9 @@ namespace llvm {
|
|||||||
unsigned RunTimeLang = 0,
|
unsigned RunTimeLang = 0,
|
||||||
MDNode *ContainingType = 0);
|
MDNode *ContainingType = 0);
|
||||||
|
|
||||||
|
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
|
||||||
|
DIType CreateArtificialType(DIType Ty);
|
||||||
|
|
||||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||||
DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
|
DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
|
||||||
StringRef Name,
|
StringRef Name,
|
||||||
|
@ -725,6 +725,29 @@ DIBasicType DIFactory::CreateBasicTypeEx(DIDescriptor Context,
|
|||||||
return DIBasicType(MDNode::get(VMContext, &Elts[0], 10));
|
return DIBasicType(MDNode::get(VMContext, &Elts[0], 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
|
||||||
|
DIType DIFactory::CreateArtificialType(DIType Ty) {
|
||||||
|
if (Ty.isArtificial())
|
||||||
|
return Ty;
|
||||||
|
|
||||||
|
SmallVector<Value *, 9> Elts;
|
||||||
|
MDNode *N = Ty.getNode();
|
||||||
|
assert (N && "Unexpected input DIType!");
|
||||||
|
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
||||||
|
if (Value *V = N->getOperand(i))
|
||||||
|
Elts.push_back(V);
|
||||||
|
else
|
||||||
|
Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned CurFlags = Ty.getFlags();
|
||||||
|
CurFlags = CurFlags | DIType::FlagArtificial;
|
||||||
|
|
||||||
|
// Flags are stored at this slot.
|
||||||
|
Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
|
||||||
|
|
||||||
|
return DIType(MDNode::get(VMContext, Elts.data(), Elts.size()));
|
||||||
|
}
|
||||||
|
|
||||||
/// CreateDerivedType - Create a derived type like const qualified type,
|
/// CreateDerivedType - Create a derived type like const qualified type,
|
||||||
/// pointer, typedef, etc.
|
/// pointer, typedef, etc.
|
||||||
|
@ -1214,8 +1214,10 @@ DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) {
|
|||||||
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
||||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
||||||
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
||||||
addType(Arg, DIType(Args.getElement(i).getNode()));
|
DIType ATy = DIType(DIType(Args.getElement(i).getNode()));
|
||||||
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1); // ??
|
addType(Arg, ATy);
|
||||||
|
if (ATy.isArtificial())
|
||||||
|
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
SPDie->addChild(Arg);
|
SPDie->addChild(Arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1342,8 +1344,10 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) {
|
|||||||
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
||||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
||||||
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
|
||||||
addType(Arg, DIType(Args.getElement(i).getNode()));
|
DIType ATy = DIType(DIType(Args.getElement(i).getNode()));
|
||||||
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1); // ??
|
addType(Arg, ATy);
|
||||||
|
if (ATy.isArtificial())
|
||||||
|
addUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
SPDie->addChild(Arg);
|
SPDie->addChild(Arg);
|
||||||
}
|
}
|
||||||
DIE *SPDeclDie = SPDie;
|
DIE *SPDeclDie = SPDie;
|
||||||
@ -1352,7 +1356,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) {
|
|||||||
SPDeclDie);
|
SPDeclDie);
|
||||||
ModuleCU->addDie(SPDie);
|
ModuleCU->addDie(SPDie);
|
||||||
}
|
}
|
||||||
|
|
||||||
addLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
addLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||||
DWLabel("func_begin", SubprogramCount));
|
DWLabel("func_begin", SubprogramCount));
|
||||||
addLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
addLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
||||||
@ -1515,6 +1519,9 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
|
|||||||
else
|
else
|
||||||
addAddress(VariableDie, dwarf::DW_AT_location, Location);
|
addAddress(VariableDie, dwarf::DW_AT_location, Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Tag == dwarf::DW_TAG_formal_parameter && VD.getType().isArtificial())
|
||||||
|
addUInt(VariableDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
DV->setDIE(VariableDie);
|
DV->setDIE(VariableDie);
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user