mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	More MC layering violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -60,27 +60,27 @@ static unsigned mblazeBinary2Opcode[] = { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| static unsigned getRD(uint32_t insn) { | static unsigned getRD(uint32_t insn) { | ||||||
|   if (!MBlazeRegisterInfo::isRegister((insn>>21)&0x1F)) |   if (!isMBlazeRegister((insn>>21)&0x1F)) | ||||||
|     return UNSUPPORTED; |     return UNSUPPORTED; | ||||||
|   return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>21)&0x1F); |   return getMBlazeRegisterNumbering((insn>>21)&0x1F); | ||||||
| } | } | ||||||
|  |  | ||||||
| static unsigned getRA(uint32_t insn) { | static unsigned getRA(uint32_t insn) { | ||||||
|   if (!MBlazeRegisterInfo::getRegisterFromNumbering((insn>>16)&0x1F)) |   if (!getMBlazeRegisterNumbering((insn>>16)&0x1F)) | ||||||
|     return UNSUPPORTED; |     return UNSUPPORTED; | ||||||
|   return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>16)&0x1F); |   return getMBlazeRegisterNumbering((insn>>16)&0x1F); | ||||||
| } | } | ||||||
|  |  | ||||||
| static unsigned getRB(uint32_t insn) { | static unsigned getRB(uint32_t insn) { | ||||||
|   if (!MBlazeRegisterInfo::getRegisterFromNumbering((insn>>11)&0x1F)) |   if (!getMBlazeRegisterNumbering((insn>>11)&0x1F)) | ||||||
|     return UNSUPPORTED; |     return UNSUPPORTED; | ||||||
|   return MBlazeRegisterInfo::getRegisterFromNumbering((insn>>11)&0x1F); |   return getMBlazeRegisterNumbering((insn>>11)&0x1F); | ||||||
| } | } | ||||||
|  |  | ||||||
| static int64_t getRS(uint32_t insn) { | static int64_t getRS(uint32_t insn) { | ||||||
|   if (!MBlazeRegisterInfo::isSpecialRegister(insn&0x3FFF)) |   if (!isSpecialMBlazeRegister(insn&0x3FFF)) | ||||||
|     return UNSUPPORTED; |     return UNSUPPORTED; | ||||||
|   return MBlazeRegisterInfo::getSpecialRegisterFromNumbering(insn&0x3FFF); |   return getSpecialMBlazeRegisterFromNumbering(insn&0x3FFF); | ||||||
| } | } | ||||||
|  |  | ||||||
| static int64_t getIMM(uint32_t insn) { | static int64_t getIMM(uint32_t insn) { | ||||||
|   | |||||||
| @@ -86,57 +86,6 @@ unsigned MBlazeRegisterInfo::getRegisterFromNumbering(unsigned Reg) { | |||||||
|   return 0; // Not reached |   return 0; // Not reached | ||||||
| } | } | ||||||
|  |  | ||||||
| unsigned MBlazeRegisterInfo::getSpecialRegisterFromNumbering(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 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| bool MBlazeRegisterInfo::isRegister(unsigned Reg) { |  | ||||||
|   return Reg <= 31; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| bool MBlazeRegisterInfo::isSpecialRegister(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 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| unsigned MBlazeRegisterInfo::getPICCallReg() { | unsigned MBlazeRegisterInfo::getPICCallReg() { | ||||||
|   return MBlaze::R20; |   return MBlaze::R20; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -43,9 +43,6 @@ struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo { | |||||||
|                      const TargetInstrInfo &tii); |                      const TargetInstrInfo &tii); | ||||||
|  |  | ||||||
|   static unsigned getRegisterFromNumbering(unsigned RegEnum); |   static unsigned getRegisterFromNumbering(unsigned RegEnum); | ||||||
|   static unsigned getSpecialRegisterFromNumbering(unsigned RegEnum); |  | ||||||
|   static bool isRegister(unsigned RegEnum); |  | ||||||
|   static bool isSpecialRegister(unsigned RegEnum); |  | ||||||
|  |  | ||||||
|   /// Get PIC indirect call register |   /// Get PIC indirect call register | ||||||
|   static unsigned getPICCallReg(); |   static unsigned getPICCallReg(); | ||||||
|   | |||||||
| @@ -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. | /// getMBlazeRegisterNumbering - Given the enum value for some register, e.g. | ||||||
| /// MBlaze::R0, return the number that it corresponds to (e.g. 0). | /// MBlaze::R0, return the number that it corresponds to (e.g. 0). | ||||||
| static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { | static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { | ||||||
| @@ -143,6 +163,37 @@ static inline unsigned getMBlazeRegisterNumbering(unsigned RegEnum) { | |||||||
|   return 0; // Not reached |   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; | } // end namespace llvm; | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user