mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Refactor and reduce code duplication for non-split dwarf strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d7109840cd
commit
98b356bc64
@ -195,24 +195,14 @@ void DwarfUnit::addSInt(DIEBlock *Die, Optional<dwarf::Form> Form,
|
|||||||
/// table.
|
/// table.
|
||||||
void DwarfUnit::addString(DIE *Die, dwarf::Attribute Attribute,
|
void DwarfUnit::addString(DIE *Die, dwarf::Attribute Attribute,
|
||||||
StringRef String) {
|
StringRef String) {
|
||||||
DIEValue *Value;
|
|
||||||
dwarf::Form Form;
|
if (!DD->useSplitDwarf())
|
||||||
if (!DD->useSplitDwarf()) {
|
return addLocalString(Die, Attribute, String);
|
||||||
MCSymbol *Symb = DU->getStringPoolEntry(String);
|
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
unsigned idx = DU->getStringPoolIndex(String);
|
||||||
Value = new (DIEValueAllocator) DIELabel(Symb);
|
DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
|
||||||
else {
|
|
||||||
MCSymbol *StringPool = DU->getStringPoolSym();
|
|
||||||
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
|
|
||||||
}
|
|
||||||
Form = dwarf::DW_FORM_strp;
|
|
||||||
} else {
|
|
||||||
unsigned idx = DU->getStringPoolIndex(String);
|
|
||||||
Value = new (DIEValueAllocator) DIEInteger(idx);
|
|
||||||
Form = dwarf::DW_FORM_GNU_str_index;
|
|
||||||
}
|
|
||||||
DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
|
DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
|
||||||
Die->addValue(Attribute, Form, Str);
|
Die->addValue(Attribute, dwarf::DW_FORM_GNU_str_index, Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addLocalString - Add a string attribute data and value. This is guaranteed
|
/// addLocalString - Add a string attribute data and value. This is guaranteed
|
||||||
@ -227,7 +217,8 @@ void DwarfUnit::addLocalString(DIE *Die, dwarf::Attribute Attribute,
|
|||||||
MCSymbol *StringPool = DU->getStringPoolSym();
|
MCSymbol *StringPool = DU->getStringPoolSym();
|
||||||
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
|
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
|
||||||
}
|
}
|
||||||
Die->addValue(Attribute, dwarf::DW_FORM_strp, Value);
|
DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
|
||||||
|
Die->addValue(Attribute, dwarf::DW_FORM_strp, Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addExpr - Add a Dwarf expression attribute data and value.
|
/// addExpr - Add a Dwarf expression attribute data and value.
|
||||||
|
Loading…
Reference in New Issue
Block a user