mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Let FE mark a variable as artificial variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115102 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e487b017e9
commit
3cf763dc7a
@ -502,6 +502,13 @@ namespace llvm {
|
|||||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||||
DIType getType() const { return getFieldAs<DIType>(5); }
|
DIType getType() const { return getFieldAs<DIType>(5); }
|
||||||
|
|
||||||
|
/// isArtificial - Return true if this variable is marked as "artificial".
|
||||||
|
bool isArtificial() const {
|
||||||
|
if (getVersion() <= llvm::LLVMDebugVersion8)
|
||||||
|
return false;
|
||||||
|
return (getUnsignedField(6) & FlagArtificial) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Verify - Verify that a variable descriptor is well formed.
|
/// Verify - Verify that a variable descriptor is well formed.
|
||||||
bool Verify() const;
|
bool Verify() const;
|
||||||
@ -738,7 +745,8 @@ namespace llvm {
|
|||||||
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||||
StringRef Name,
|
StringRef Name,
|
||||||
DIFile F, unsigned LineNo,
|
DIFile F, unsigned LineNo,
|
||||||
DIType Ty, bool AlwaysPreserve = false);
|
DIType Ty, bool AlwaysPreserve = false,
|
||||||
|
unsigned Flags = 0);
|
||||||
|
|
||||||
/// CreateComplexVariable - Create a new descriptor for the specified
|
/// CreateComplexVariable - Create a new descriptor for the specified
|
||||||
/// variable which has a complex address expression for its address.
|
/// variable which has a complex address expression for its address.
|
||||||
|
@ -109,7 +109,9 @@ Function *DIDescriptor::getFunctionField(unsigned Elt) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned DIVariable::getNumAddrElements() const {
|
unsigned DIVariable::getNumAddrElements() const {
|
||||||
return DbgNode->getNumOperands()-6;
|
if (getVersion() <= llvm::LLVMDebugVersion8)
|
||||||
|
return DbgNode->getNumOperands()-6;
|
||||||
|
return DbgNode->getNumOperands()-7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1145,7 +1147,8 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
|
|||||||
StringRef Name,
|
StringRef Name,
|
||||||
DIFile F,
|
DIFile F,
|
||||||
unsigned LineNo,
|
unsigned LineNo,
|
||||||
DIType Ty, bool AlwaysPreserve) {
|
DIType Ty, bool AlwaysPreserve,
|
||||||
|
unsigned Flags) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(Tag),
|
GetTagConstant(Tag),
|
||||||
Context,
|
Context,
|
||||||
@ -1153,8 +1156,9 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
|
|||||||
F,
|
F,
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
||||||
Ty,
|
Ty,
|
||||||
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags)
|
||||||
};
|
};
|
||||||
MDNode *Node = MDNode::get(VMContext, &Elts[0], 6);
|
MDNode *Node = MDNode::get(VMContext, &Elts[0], 7);
|
||||||
if (AlwaysPreserve) {
|
if (AlwaysPreserve) {
|
||||||
// The optimizer may remove local variable. If there is an interest
|
// The optimizer may remove local variable. If there is an interest
|
||||||
// to preserve variable info in such situation then stash it in a
|
// to preserve variable info in such situation then stash it in a
|
||||||
|
@ -1624,6 +1624,8 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
|
|||||||
|
|
||||||
if (Tag == dwarf::DW_TAG_formal_parameter && DV->getType().isArtificial())
|
if (Tag == dwarf::DW_TAG_formal_parameter && DV->getType().isArtificial())
|
||||||
addUInt(VariableDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
addUInt(VariableDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
|
else if (DIVariable(DV->getVariable()).isArtificial())
|
||||||
|
addUInt(VariableDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
if (Scope->isAbstractScope()) {
|
if (Scope->isAbstractScope()) {
|
||||||
DV->setDIE(VariableDie);
|
DV->setDIE(VariableDie);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user