llvm.org GIT mirror llvm / 483ec21
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 Dale Johannesen 12 years ago
3 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
653653 assert(AmbEntries.empty() && "Duplicated entries in unfolding maps?");
654654 }
655655
656 // getDwarfRegNum - This function maps LLVM register identifiers to the
657 // Dwarf specific numbering, used in debug info and exception tables.
658 // The registers are given "basic" dwarf numbers in the .td files,
659 // which are collected by TableGen into X86GenRegisterInfo::getDwarfRegNum.
660 // This wrapper allows for target-specific overrides.
661 int X86RegisterInfo::getDwarfRegNum(unsigned RegNo) const {
662 int n = X86GenRegisterInfo::getDwarfRegNum(RegNo);
663 const X86Subtarget *Subtarget = &TM.getSubtarget();
664 if (Subtarget->isDarwin) {
665 // ESP and EBP are switched.
666 if (n==4) return 5;
667 if (n==5) return 4;
668 }
669 return n;
670 }
671
656672 // getX86RegNum - This function maps LLVM register identifiers to their X86
657673 // specific numbering, which is used in various places encoding instructions.
658674 //
7575 /// getX86RegNum - Returns the native X86 register number for the given LLVM
7676 /// register identifier.
7777 unsigned getX86RegNum(unsigned RegNo);
78
79 /// getDwarfRegNum - allows modification of X86GenRegisterInfo::getDwarfRegNum
80 /// (created by TableGen) for target dependencies.
81 int getDwarfRegNum(unsigned RegNum) const;
7882
7983 /// Code Generation virtual methods...
8084 ///
5959 OS << "struct " << ClassName << " : public MRegisterInfo {\n"
6060 << " " << ClassName
6161 << "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
62 << " int getDwarfRegNum(unsigned RegNum) const;\n"
62 << " virtual int getDwarfRegNum(unsigned RegNum) const;\n"
6363 << " unsigned getSubReg(unsigned RegNo, unsigned Index) const;\n"
6464 << "};\n\n";
6565