[llvm-commits] [llvm] r134202 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h include/llvm/Target/TargetRegisterInfo.h lib/Target/X86/X86RegisterInfo.cpp lib/Target/X86/X86RegisterInfo.h
Bill Wendling
isanbard at gmail.com
Thu Jun 30 16:20:32 PDT 2011
Author: void
Date: Thu Jun 30 18:20:32 2011
New Revision: 134202
URL: http://llvm.org/viewvc/llvm-project?rev=134202&view=rev
Log:
Add target a target hook to get the register number used by the compact unwind
encoding for the registers it knows about. Return -1 if it can't handle that
register.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=134202&r1=134201&r2=134202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Thu Jun 30 18:20:32 2011
@@ -106,6 +106,10 @@
int getSEHRegNum(unsigned RegNum) const {
return TRI->getSEHRegNum(RegNum);
}
+
+ int getCompactUnwindRegNum(unsigned RegNum) const {
+ return TRI->getCompactUnwindRegNum(RegNum);
+ }
};
}
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=134202&r1=134201&r2=134202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Thu Jun 30 18:20:32 2011
@@ -720,6 +720,12 @@
virtual int getSEHRegNum(unsigned i) const {
return i;
}
+
+ /// getCompactUnwindRegNum - This function maps the register to the number for
+ /// compact unwind encoding. Return -1 if the register isn't valid.
+ virtual int getCompactUnwindRegNum(unsigned) const {
+ return -1;
+ }
};
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=134202&r1=134201&r2=134202&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jun 30 18:20:32 2011
@@ -105,6 +105,21 @@
return X86GenRegisterInfo::getLLVMRegNumFull(DwarfRegNo, Flavour);
}
+/// getCompactUnwindRegNum - This function maps the register to the number for
+/// compact unwind encoding. Return -1 if the register isn't valid.
+int X86RegisterInfo::getCompactUnwindRegNum(unsigned RegNum) const {
+ switch (RegNum) {
+ case X86::EBX: case X86::RBX: return 1;
+ case X86::ECX: case X86::RCX: return 2;
+ case X86::EDX: case X86::RDX: return 3;
+ case X86::EDI: case X86::RDI: return 4;
+ case X86::ESI: case X86::RSI: return 5;
+ case X86::EBP: case X86::RBP: return 6;
+ }
+
+ return -1;
+}
+
int
X86RegisterInfo::getSEHRegNum(unsigned i) const {
int reg = getX86RegNum(i);
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=134202&r1=134201&r2=134202&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jun 30 18:20:32 2011
@@ -81,6 +81,10 @@
// FIXME: This should be tablegen'd like getDwarfRegNum is
int getSEHRegNum(unsigned i) const;
+ /// getCompactUnwindRegNum - This function maps the register to the number for
+ /// compact unwind encoding. Return -1 if the register isn't valid.
+ int getCompactUnwindRegNum(unsigned RegNum) const;
+
/// Code Generation virtual methods...
///
More information about the llvm-commits
mailing list