diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 22:16:37 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 22:16:37 +0000 |
commit | 617793d1d6fa28eb47d4fc04d265a6eace6c758c (patch) | |
tree | 47c30d326137de66c12ded54c72e2aba396fe0ba /lib | |
parent | f16f3476a2faf2bab03ad54eedaf255b49207392 (diff) |
Refactoring fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135986 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp | 10 | ||||
-rw-r--r-- | lib/Target/MBlaze/MBlazeISelLowering.cpp | 2 | ||||
-rw-r--r-- | lib/Target/MBlaze/MBlazeRegisterInfo.cpp | 41 | ||||
-rw-r--r-- | lib/Target/MBlaze/MBlazeRegisterInfo.h | 2 | ||||
-rw-r--r-- | lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h | 41 |
5 files changed, 47 insertions, 49 deletions
diff --git a/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp b/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp index 7c15d7650c..309bda1d64 100644 --- a/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp +++ b/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp @@ -62,19 +62,19 @@ static unsigned mblazeBinary2Opcode[] = { static unsigned getRD(uint32_t insn) { if (!isMBlazeRegister((insn>>21)&0x1F)) return UNSUPPORTED; - return getMBlazeRegisterNumbering((insn>>21)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>21)&0x1F); } static unsigned getRA(uint32_t insn) { - if (!getMBlazeRegisterNumbering((insn>>16)&0x1F)) + if (!getMBlazeRegisterFromNumbering((insn>>16)&0x1F)) return UNSUPPORTED; - return getMBlazeRegisterNumbering((insn>>16)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>16)&0x1F); } static unsigned getRB(uint32_t insn) { - if (!getMBlazeRegisterNumbering((insn>>11)&0x1F)) + if (!getMBlazeRegisterFromNumbering((insn>>11)&0x1F)) return UNSUPPORTED; - return getMBlazeRegisterNumbering((insn>>11)&0x1F); + return getMBlazeRegisterFromNumbering((insn>>11)&0x1F); } static int64_t getRS(uint32_t insn) { diff --git a/lib/Target/MBlaze/MBlazeISelLowering.cpp b/lib/Target/MBlaze/MBlazeISelLowering.cpp index a36e5108a3..8a1774e7a2 100644 --- a/lib/Target/MBlaze/MBlazeISelLowering.cpp +++ b/lib/Target/MBlaze/MBlazeISelLowering.cpp @@ -970,7 +970,7 @@ LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, unsigned StackLoc = Start - Begin + 1; for (; Start <= End; ++Start, ++StackLoc) { - unsigned Reg = MBlazeRegisterInfo::getRegisterFromNumbering(Start); + unsigned Reg = getMBlazeRegisterFromNumbering(Start); unsigned LiveReg = MF.addLiveIn(Reg, RC); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, LiveReg, MVT::i32); diff --git a/lib/Target/MBlaze/MBlazeRegisterInfo.cpp b/lib/Target/MBlaze/MBlazeRegisterInfo.cpp index 2a8a1b6755..9788ba9e60 100644 --- a/lib/Target/MBlaze/MBlazeRegisterInfo.cpp +++ b/lib/Target/MBlaze/MBlazeRegisterInfo.cpp @@ -45,47 +45,6 @@ MBlazeRegisterInfo:: MBlazeRegisterInfo(const MBlazeSubtarget &ST, const TargetInstrInfo &tii) : MBlazeGenRegisterInfo(MBlaze::R15), Subtarget(ST), TII(tii) {} -/// getRegisterFromNumbering - Given the enum value for some register, e.g. -/// MBlaze::R0, return the number that it corresponds to (e.g. 0). -unsigned MBlazeRegisterInfo::getRegisterFromNumbering(unsigned Reg) { - switch (Reg) { - case 0 : return MBlaze::R0; - case 1 : return MBlaze::R1; - case 2 : return MBlaze::R2; - case 3 : return MBlaze::R3; - case 4 : return MBlaze::R4; - case 5 : return MBlaze::R5; - case 6 : return MBlaze::R6; - case 7 : return MBlaze::R7; - case 8 : return MBlaze::R8; - case 9 : return MBlaze::R9; - case 10 : return MBlaze::R10; - case 11 : return MBlaze::R11; - case 12 : return MBlaze::R12; - case 13 : return MBlaze::R13; - case 14 : return MBlaze::R14; - case 15 : return MBlaze::R15; - case 16 : return MBlaze::R16; - case 17 : return MBlaze::R17; - case 18 : return MBlaze::R18; - case 19 : return MBlaze::R19; - case 20 : return MBlaze::R20; - case 21 : return MBlaze::R21; - case 22 : return MBlaze::R22; - case 23 : return MBlaze::R23; - case 24 : return MBlaze::R24; - case 25 : return MBlaze::R25; - case 26 : return MBlaze::R26; - case 27 : return MBlaze::R27; - case 28 : return MBlaze::R28; - case 29 : return MBlaze::R29; - case 30 : return MBlaze::R30; - case 31 : return MBlaze::R31; - default: llvm_unreachable("Unknown register number!"); - } - return 0; // Not reached -} - unsigned MBlazeRegisterInfo::getPICCallReg() { return MBlaze::R20; } diff --git a/lib/Target/MBlaze/MBlazeRegisterInfo.h b/lib/Target/MBlaze/MBlazeRegisterInfo.h index e4e4a485d2..7e4b269cb8 100644 --- a/lib/Target/MBlaze/MBlazeRegisterInfo.h +++ b/lib/Target/MBlaze/MBlazeRegisterInfo.h @@ -42,8 +42,6 @@ struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo { MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget, const TargetInstrInfo &tii); - static unsigned getRegisterFromNumbering(unsigned RegEnum); - /// Get PIC indirect call register static unsigned getPICCallReg(); diff --git a/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h b/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h index 60336946a7..776dbc4d86 100644 --- a/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h +++ b/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h @@ -163,6 +163,47 @@ static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { return 0; // Not reached } +/// getRegisterFromNumbering - Given the enum value for some register, e.g. +/// MBlaze::R0, return the number that it corresponds to (e.g. 0). +static inline unsigned getMBlazeRegisterFromNumbering(unsigned Reg) { + switch (Reg) { + case 0 : return MBlaze::R0; + case 1 : return MBlaze::R1; + case 2 : return MBlaze::R2; + case 3 : return MBlaze::R3; + case 4 : return MBlaze::R4; + case 5 : return MBlaze::R5; + case 6 : return MBlaze::R6; + case 7 : return MBlaze::R7; + case 8 : return MBlaze::R8; + case 9 : return MBlaze::R9; + case 10 : return MBlaze::R10; + case 11 : return MBlaze::R11; + case 12 : return MBlaze::R12; + case 13 : return MBlaze::R13; + case 14 : return MBlaze::R14; + case 15 : return MBlaze::R15; + case 16 : return MBlaze::R16; + case 17 : return MBlaze::R17; + case 18 : return MBlaze::R18; + case 19 : return MBlaze::R19; + case 20 : return MBlaze::R20; + case 21 : return MBlaze::R21; + case 22 : return MBlaze::R22; + case 23 : return MBlaze::R23; + case 24 : return MBlaze::R24; + case 25 : return MBlaze::R25; + case 26 : return MBlaze::R26; + case 27 : return MBlaze::R27; + case 28 : return MBlaze::R28; + case 29 : return MBlaze::R29; + case 30 : return MBlaze::R30; + case 31 : return MBlaze::R31; + default: llvm_unreachable("Unknown register number!"); + } + return 0; // Not reached +} + static inline unsigned getSpecialMBlazeRegisterFromNumbering(unsigned Reg) { switch (Reg) { case 0x0000 : return MBlaze::RPC; |