Allow for register numbers > 31.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29879 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Laskey 2006-08-25 19:39:52 +00:00
parent 389dae20ea
commit 3d3d404b8a

View File

@ -1219,12 +1219,22 @@ void DwarfWriter::AddSourceLine(DIE *Die, CompileUnitDesc *File, unsigned Line){
void DwarfWriter::AddAddress(DIE *Die, unsigned Attribute, void DwarfWriter::AddAddress(DIE *Die, unsigned Attribute,
const MachineLocation &Location) { const MachineLocation &Location) {
DIEBlock *Block = new DIEBlock(); DIEBlock *Block = new DIEBlock();
unsigned Reg = RI->getDwarfRegNum(Location.getRegister());
if (Location.isRegister()) { if (Location.isRegister()) {
Block->AddUInt(DW_FORM_data1, if (Reg < 32) {
DW_OP_reg0 + RI->getDwarfRegNum(Location.getRegister())); Block->AddUInt(DW_FORM_data1, DW_OP_reg0 + Reg);
} else {
Block->AddUInt(DW_FORM_data1, DW_OP_regx);
Block->AddUInt(DW_FORM_udata, Reg);
}
} else { } else {
Block->AddUInt(DW_FORM_data1, if (Reg < 32) {
DW_OP_breg0 + RI->getDwarfRegNum(Location.getRegister())); Block->AddUInt(DW_FORM_data1, DW_OP_breg0 + Reg);
} else {
Block->AddUInt(DW_FORM_data1, DW_OP_bregx);
Block->AddUInt(DW_FORM_udata, Reg);
}
Block->AddUInt(DW_FORM_sdata, Location.getOffset()); Block->AddUInt(DW_FORM_sdata, Location.getOffset());
} }
Block->ComputeSize(*this); Block->ComputeSize(*this);