mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82333 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -640,8 +640,8 @@ DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) {
|
|||||||
/// more information, read large comment just above here.
|
/// more information, read large comment just above here.
|
||||||
///
|
///
|
||||||
void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||||
unsigned Attribute,
|
unsigned Attribute,
|
||||||
const MachineLocation &Location) {
|
const MachineLocation &Location) {
|
||||||
const DIVariable &VD = DV->getVariable();
|
const DIVariable &VD = DV->getVariable();
|
||||||
DIType Ty = VD.getType();
|
DIType Ty = VD.getType();
|
||||||
DIType TmpTy = Ty;
|
DIType TmpTy = Ty;
|
||||||
@@ -662,96 +662,96 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
|||||||
std::string typeName;
|
std::string typeName;
|
||||||
blockStruct.getName(typeName);
|
blockStruct.getName(typeName);
|
||||||
|
|
||||||
assert(typeName.find ("__Block_byref_") == 0
|
assert(typeName.find ("__Block_byref_") == 0
|
||||||
&& "Attempting to get Block location of non-Block variable!");
|
&& "Attempting to get Block location of non-Block variable!");
|
||||||
|
|
||||||
// Find the __forwarding field and the variable field in the __Block_byref
|
// Find the __forwarding field and the variable field in the __Block_byref
|
||||||
// struct.
|
// struct.
|
||||||
|
|
||||||
DIArray Fields = blockStruct.getTypeArray();
|
DIArray Fields = blockStruct.getTypeArray();
|
||||||
DIDescriptor varField = DIDescriptor();
|
DIDescriptor varField = DIDescriptor();
|
||||||
DIDescriptor forwardingField = DIDescriptor();
|
DIDescriptor forwardingField = DIDescriptor();
|
||||||
|
|
||||||
|
|
||||||
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
|
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
|
||||||
DIDescriptor Element = Fields.getElement(i);
|
DIDescriptor Element = Fields.getElement(i);
|
||||||
DIDerivedType DT = DIDerivedType(Element.getNode());
|
DIDerivedType DT = DIDerivedType(Element.getNode());
|
||||||
std::string fieldName;
|
std::string fieldName;
|
||||||
DT.getName(fieldName);
|
DT.getName(fieldName);
|
||||||
if (fieldName == "__forwarding")
|
if (fieldName == "__forwarding")
|
||||||
forwardingField = Element;
|
forwardingField = Element;
|
||||||
else if (fieldName == varName)
|
else if (fieldName == varName)
|
||||||
varField = Element;
|
varField = Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (!varField.isNull() && "Can't find byref variable in Block struct");
|
assert (!varField.isNull() && "Can't find byref variable in Block struct");
|
||||||
assert (!forwardingField.isNull()
|
assert (!forwardingField.isNull()
|
||||||
&& "Can't find forwarding field in Block struct");
|
&& "Can't find forwarding field in Block struct");
|
||||||
|
|
||||||
// Get the offsets for the forwarding field and the variable field.
|
// Get the offsets for the forwarding field and the variable field.
|
||||||
|
|
||||||
unsigned int forwardingFieldOffset =
|
unsigned int forwardingFieldOffset =
|
||||||
DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3;
|
DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3;
|
||||||
unsigned int varFieldOffset =
|
unsigned int varFieldOffset =
|
||||||
DIDerivedType(varField.getNode()).getOffsetInBits() >> 3;
|
DIDerivedType(varField.getNode()).getOffsetInBits() >> 3;
|
||||||
|
|
||||||
// Decode the original location, and use that as the start of the
|
// Decode the original location, and use that as the start of the
|
||||||
// byref variable's location.
|
// byref variable's location.
|
||||||
|
|
||||||
unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false);
|
unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false);
|
||||||
DIEBlock *Block = new DIEBlock();
|
DIEBlock *Block = new DIEBlock();
|
||||||
|
|
||||||
if (Location.isReg()) {
|
if (Location.isReg()) {
|
||||||
if (Reg < 32)
|
if (Reg < 32)
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + Reg);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + Reg);
|
||||||
else {
|
else {
|
||||||
Reg = Reg - dwarf::DW_OP_reg0;
|
Reg = Reg - dwarf::DW_OP_reg0;
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg);
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg);
|
AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Reg < 32)
|
if (Reg < 32)
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + Reg);
|
||||||
else {
|
else {
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx);
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg);
|
AddUInt(Block, 0, dwarf::DW_FORM_udata, Reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset());
|
AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we started with a pointer to the__Block_byref... struct, then
|
// If we started with a pointer to the__Block_byref... struct, then
|
||||||
// the first thing we need to do is dereference the pointer (DW_OP_deref).
|
// the first thing we need to do is dereference the pointer (DW_OP_deref).
|
||||||
|
|
||||||
if (isPointer)
|
if (isPointer)
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
|
||||||
|
|
||||||
// Next add the offset for the '__forwarding' field:
|
// Next add the offset for the '__forwarding' field:
|
||||||
// DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in
|
// DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in
|
||||||
// adding the offset if it's 0.
|
// adding the offset if it's 0.
|
||||||
|
|
||||||
if (forwardingFieldOffset > 0) {
|
if (forwardingFieldOffset > 0) {
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset);
|
AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now dereference the __forwarding field to get to the real __Block_byref
|
// Now dereference the __forwarding field to get to the real __Block_byref
|
||||||
// struct: DW_OP_deref.
|
// struct: DW_OP_deref.
|
||||||
|
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
|
||||||
|
|
||||||
// Now that we've got the real __Block_byref... struct, add the offset
|
// Now that we've got the real __Block_byref... struct, add the offset
|
||||||
// for the variable's field to get to the location of the actual variable:
|
// for the variable's field to get to the location of the actual variable:
|
||||||
// DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0.
|
// DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0.
|
||||||
|
|
||||||
if (varFieldOffset > 0) {
|
if (varFieldOffset > 0) {
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
|
AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
|
||||||
AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset);
|
AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now attach the location information to the DIE.
|
// Now attach the location information to the DIE.
|
||||||
|
|
||||||
AddBlock(Die, Attribute, 0, Block);
|
AddBlock(Die, Attribute, 0, Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AddAddress - Add an address attribute to a die based on the location
|
/// AddAddress - Add an address attribute to a die based on the location
|
||||||
@@ -995,7 +995,7 @@ void DwarfDebug::ConstructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy){
|
|||||||
if (L)
|
if (L)
|
||||||
AddSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
|
AddSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
|
||||||
if (H)
|
if (H)
|
||||||
AddSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
|
AddSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
|
||||||
|
|
||||||
Buffer.AddChild(DW_Subrange);
|
Buffer.AddChild(DW_Subrange);
|
||||||
}
|
}
|
||||||
@@ -1056,7 +1056,7 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
|||||||
AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
||||||
LinkageName);
|
LinkageName);
|
||||||
}
|
}
|
||||||
AddType(DW_Unit, GVDie, GV.getType());
|
AddType(DW_Unit, GVDie, GV.getType());
|
||||||
if (!GV.isLocalToUnit())
|
if (!GV.isLocalToUnit())
|
||||||
AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
|
AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
|
||||||
AddSourceLine(GVDie, &GV);
|
AddSourceLine(GVDie, &GV);
|
||||||
@@ -1545,9 +1545,9 @@ void DwarfDebug::ConstructSubprogram(MDNode *N) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BeginModule - Emit all Dwarf sections that should come prior to the
|
/// BeginModule - Emit all Dwarf sections that should come prior to the
|
||||||
/// content. Create global DIEs and emit initial debug info sections.
|
/// content. Create global DIEs and emit initial debug info sections.
|
||||||
/// This is inovked by the target AsmPrinter.
|
/// This is inovked by the target AsmPrinter.
|
||||||
void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) {
|
void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) {
|
||||||
this->M = M;
|
this->M = M;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user