Use isReg(), isImm() and isFPImm().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2010-04-27 22:04:41 +00:00
parent dcde3db38e
commit 97303ee27d

View File

@ -1537,17 +1537,15 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
if (const MachineInstr *DbgValueInsn = DV->getDbgValue()) { if (const MachineInstr *DbgValueInsn = DV->getDbgValue()) {
if (DbgValueInsn->getNumOperands() == 3) { if (DbgValueInsn->getNumOperands() == 3) {
// FIXME : Handle getNumOperands != 3 // FIXME : Handle getNumOperands != 3
if (DbgValueInsn->getOperand(0).getType() if (DbgValueInsn->getOperand(0).isReg() &&
== MachineOperand::MO_Register DbgValueInsn->getOperand(0).getReg()) {
&& DbgValueInsn->getOperand(0).getReg()) {
MachineLocation Location; MachineLocation Location;
Location.set(DbgValueInsn->getOperand(0).getReg()); Location.set(DbgValueInsn->getOperand(0).getReg());
addAddress(VariableDie, dwarf::DW_AT_location, Location); addAddress(VariableDie, dwarf::DW_AT_location, Location);
if (MCSymbol *VS = DV->getDbgValueLabel()) if (MCSymbol *VS = DV->getDbgValueLabel())
addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
VS); VS);
} else if (DbgValueInsn->getOperand(0).getType() == } else if (DbgValueInsn->getOperand(0).isImm()) {
MachineOperand::MO_Immediate) {
DIEBlock *Block = new (DIEValueAllocator) DIEBlock(); DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
unsigned Imm = DbgValueInsn->getOperand(0).getImm(); unsigned Imm = DbgValueInsn->getOperand(0).getImm();
addUInt(Block, 0, dwarf::DW_FORM_udata, Imm); addUInt(Block, 0, dwarf::DW_FORM_udata, Imm);
@ -1555,8 +1553,7 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, DbgScope *Scope) {
if (MCSymbol *VS = DV->getDbgValueLabel()) if (MCSymbol *VS = DV->getDbgValueLabel())
addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr, addLabel(VariableDie, dwarf::DW_AT_start_scope, dwarf::DW_FORM_addr,
VS); VS);
} else if (DbgValueInsn->getOperand(0).getType() == } else if (DbgValueInsn->getOperand(0).isFPImm()) {
MachineOperand::MO_FPImmediate) {
DIEBlock *Block = new (DIEValueAllocator) DIEBlock(); DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
APFloat FPImm = DbgValueInsn->getOperand(0).getFPImm()->getValueAPF(); APFloat FPImm = DbgValueInsn->getOperand(0).getFPImm()->getValueAPF();
@ -2083,8 +2080,7 @@ void DwarfDebug::collectVariableInfo() {
continue; continue;
// Ignore Undef values. // Ignore Undef values.
if (MInsn->getOperand(0).getType() == MachineOperand::MO_Register if (MInsn->getOperand(0).isReg() && !MInsn->getOperand(0).getReg())
&& !MInsn->getOperand(0).getReg())
continue; continue;
DIVariable DV( DIVariable DV(