diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 21:29:26 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 21:29:26 +0000 |
commit | d1200aa4f8b9043bbb63d6076feb82c759a6585a (patch) | |
tree | f2e1c29589222512e0f82acc3b21643af068f21a /lib/Target/MBlaze/MCTargetDesc | |
parent | 093b8cabbc727ed107ff1e3032911c90d570c64e (diff) | |
download | external_llvm-d1200aa4f8b9043bbb63d6076feb82c759a6585a.zip external_llvm-d1200aa4f8b9043bbb63d6076feb82c759a6585a.tar.gz external_llvm-d1200aa4f8b9043bbb63d6076feb82c759a6585a.tar.bz2 |
More MC layering violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MBlaze/MCTargetDesc')
-rw-r--r-- | lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h b/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h index d6d3fe1..6033694 100644 --- a/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h +++ b/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h @@ -78,6 +78,26 @@ namespace MBlazeII { }; } +static inline bool isMBlazeRegister(unsigned Reg) { + return Reg <= 31; +} + +static inline bool isSpecialMBlazeRegister(unsigned Reg) { + switch (Reg) { + case 0x0000 : case 0x0001 : case 0x0003 : case 0x0005 : + case 0x0007 : case 0x000B : case 0x000D : case 0x1000 : + case 0x1001 : case 0x1002 : case 0x1003 : case 0x1004 : + case 0x2000 : case 0x2001 : case 0x2002 : case 0x2003 : + case 0x2004 : case 0x2005 : case 0x2006 : case 0x2007 : + case 0x2008 : case 0x2009 : case 0x200A : case 0x200B : + return true; + + default: + return false; + } + return false; // Not reached +} + /// getMBlazeRegisterNumbering - Given the enum value for some register, e.g. /// MBlaze::R0, return the number that it corresponds to (e.g. 0). static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { @@ -143,6 +163,37 @@ static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { return 0; // Not reached } +static inline unsigned getSpecialMBlazeRegisterFromNumbering(unsigned Reg) { + switch (Reg) { + case 0x0000 : return MBlaze::RPC; + case 0x0001 : return MBlaze::RMSR; + case 0x0003 : return MBlaze::REAR; + case 0x0005 : return MBlaze::RESR; + case 0x0007 : return MBlaze::RFSR; + case 0x000B : return MBlaze::RBTR; + case 0x000D : return MBlaze::REDR; + case 0x1000 : return MBlaze::RPID; + case 0x1001 : return MBlaze::RZPR; + case 0x1002 : return MBlaze::RTLBX; + case 0x1003 : return MBlaze::RTLBLO; + case 0x1004 : return MBlaze::RTLBHI; + case 0x2000 : return MBlaze::RPVR0; + case 0x2001 : return MBlaze::RPVR1; + case 0x2002 : return MBlaze::RPVR2; + case 0x2003 : return MBlaze::RPVR3; + case 0x2004 : return MBlaze::RPVR4; + case 0x2005 : return MBlaze::RPVR5; + case 0x2006 : return MBlaze::RPVR6; + case 0x2007 : return MBlaze::RPVR7; + case 0x2008 : return MBlaze::RPVR8; + case 0x2009 : return MBlaze::RPVR9; + case 0x200A : return MBlaze::RPVR10; + case 0x200B : return MBlaze::RPVR11; + default: llvm_unreachable("Unknown register number!"); + } + return 0; // Not reached +} + } // end namespace llvm; #endif |