Simplify handling of variables with complex address (i.e. blocks variables)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130339 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2011-04-27 22:45:24 +00:00
parent 2790ba8e5a
commit e1cdf84ee5
3 changed files with 32 additions and 44 deletions

View File

@ -192,16 +192,10 @@ void CompileUnit::addSourceLine(DIE *Die, DINameSpace NS) {
addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);
}
/// addFrameVariableAddress - Add DW_AT_location attribute for a
/// DbgVariable based on provided frame index.
void CompileUnit::addFrameVariableAddress(DbgVariable *&DV, DIE *Die,
int64_t FI) {
MachineLocation Location;
unsigned FrameReg;
const TargetFrameLowering *TFI = Asm->TM.getFrameLowering();
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
Location.set(FrameReg, Offset);
/// addVariableAddress - Add DW_AT_location attribute for a
/// DbgVariable based on provided MachineLocation.
void CompileUnit::addVariableAddress(DbgVariable *&DV, DIE *Die,
MachineLocation Location) {
if (DV->variableHasComplexAddress())
addComplexAddress(DV, Die, dwarf::DW_AT_location, Location);
else if (DV->isBlockByrefVariable())
@ -255,17 +249,6 @@ void CompileUnit::addAddress(DIE *Die, unsigned Attribute,
addBlock(Die, Attribute, 0, Block);
}
/// addRegisterAddress - Add register location entry in variable DIE.
bool CompileUnit::addRegisterAddress(DIE *Die, const MachineOperand &MO) {
assert (MO.isReg() && "Invalid machine operand!");
if (!MO.getReg())
return false;
MachineLocation Location;
Location.set(MO.getReg());
addAddress(Die, dwarf::DW_AT_location, Location);
return true;
}
/// addComplexAddress - Start with the address based on the location provided,
/// and generate the DWARF information necessary to find the actual variable
/// given the extra address information encoded in the DIVariable, starting from