Interchange Dwarf numbers of ESP and EBP on x86 Darwin.

Much improvement in exception handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43794 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2007-11-07 00:25:05 +00:00
parent a57506eea4
commit 483ec21d90
3 changed files with 21 additions and 1 deletions

View File

@ -654,6 +654,22 @@ X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm,
assert(AmbEntries.empty() && "Duplicated entries in unfolding maps?");
}
// getDwarfRegNum - This function maps LLVM register identifiers to the
// Dwarf specific numbering, used in debug info and exception tables.
// The registers are given "basic" dwarf numbers in the .td files,
// which are collected by TableGen into X86GenRegisterInfo::getDwarfRegNum.
// This wrapper allows for target-specific overrides.
int X86RegisterInfo::getDwarfRegNum(unsigned RegNo) const {
int n = X86GenRegisterInfo::getDwarfRegNum(RegNo);
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
if (Subtarget->isDarwin) {
// ESP and EBP are switched.
if (n==4) return 5;
if (n==5) return 4;
}
return n;
}
// getX86RegNum - This function maps LLVM register identifiers to their X86
// specific numbering, which is used in various places encoding instructions.
//

View File

@ -77,6 +77,10 @@ public:
/// register identifier.
unsigned getX86RegNum(unsigned RegNo);
/// getDwarfRegNum - allows modification of X86GenRegisterInfo::getDwarfRegNum
/// (created by TableGen) for target dependencies.
int getDwarfRegNum(unsigned RegNum) const;
/// Code Generation virtual methods...
///
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,

View File

@ -60,7 +60,7 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
OS << "struct " << ClassName << " : public MRegisterInfo {\n"
<< " " << ClassName
<< "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
<< " int getDwarfRegNum(unsigned RegNum) const;\n"
<< " virtual int getDwarfRegNum(unsigned RegNum) const;\n"
<< " unsigned getSubReg(unsigned RegNo, unsigned Index) const;\n"
<< "};\n\n";