1 //===-- LanaiBaseInfo.h - Top level definitions for Lanai MC ----*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file contains small standalone helper functions and enum definitions for 11 // the Lanai target useful for the compiler back-end and the MC libraries. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIBASEINFO_H 16 #define LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIBASEINFO_H 17 18 #include "LanaiMCTargetDesc.h" 19 #include "llvm/MC/MCExpr.h" 20 #include "llvm/Support/DataTypes.h" 21 #include "llvm/Support/ErrorHandling.h" 22 23 namespace llvm { 24 25 // LanaiII - This namespace holds all of the target specific flags that 26 // instruction info tracks. 27 namespace LanaiII { 28 // Target Operand Flag enum. 29 enum TOF { 30 //===------------------------------------------------------------------===// 31 // Lanai Specific MachineOperand flags. 32 MO_NO_FLAG, 33 34 // MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol 35 // address. 36 MO_ABS_HI, 37 MO_ABS_LO, 38 }; 39 } // namespace LanaiII 40 getLanaiRegisterNumbering(unsigned Reg)41static inline unsigned getLanaiRegisterNumbering(unsigned Reg) { 42 switch (Reg) { 43 case Lanai::R0: 44 return 0; 45 case Lanai::R1: 46 return 1; 47 case Lanai::R2: 48 case Lanai::PC: 49 return 2; 50 case Lanai::R3: 51 return 3; 52 case Lanai::R4: 53 case Lanai::SP: 54 return 4; 55 case Lanai::R5: 56 case Lanai::FP: 57 return 5; 58 case Lanai::R6: 59 return 6; 60 case Lanai::R7: 61 return 7; 62 case Lanai::R8: 63 case Lanai::RV: 64 return 8; 65 case Lanai::R9: 66 return 9; 67 case Lanai::R10: 68 case Lanai::RR1: 69 return 10; 70 case Lanai::R11: 71 case Lanai::RR2: 72 return 11; 73 case Lanai::R12: 74 return 12; 75 case Lanai::R13: 76 return 13; 77 case Lanai::R14: 78 return 14; 79 case Lanai::R15: 80 case Lanai::RCA: 81 return 15; 82 case Lanai::R16: 83 return 16; 84 case Lanai::R17: 85 return 17; 86 case Lanai::R18: 87 return 18; 88 case Lanai::R19: 89 return 19; 90 case Lanai::R20: 91 return 20; 92 case Lanai::R21: 93 return 21; 94 case Lanai::R22: 95 return 22; 96 case Lanai::R23: 97 return 23; 98 case Lanai::R24: 99 return 24; 100 case Lanai::R25: 101 return 25; 102 case Lanai::R26: 103 return 26; 104 case Lanai::R27: 105 return 27; 106 case Lanai::R28: 107 return 28; 108 case Lanai::R29: 109 return 29; 110 case Lanai::R30: 111 return 30; 112 case Lanai::R31: 113 return 31; 114 default: 115 llvm_unreachable("Unknown register number!"); 116 } 117 } 118 } // namespace llvm 119 #endif // LLVM_LIB_TARGET_LANAI_MCTARGETDESC_LANAIBASEINFO_H 120