Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- HexagonBaseInfo.h - Top level definitions for Hexagon --*- C++ -*--===// |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 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 Hexagon target useful for the compiler back-end and the MC libraries. |
| 12 | // As such, it deliberately does not include references to LLVM core |
| 13 | // code gen types, passes, etc.. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 17 | #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H |
| 18 | #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 19 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 20 | #include "HexagonMCTargetDesc.h" |
| 21 | #include "llvm/Support/ErrorHandling.h" |
| 22 | |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 23 | namespace llvm { |
| 24 | |
| 25 | /// HexagonII - This namespace holds all of the target specific flags that |
| 26 | /// instruction info tracks. |
| 27 | /// |
| 28 | namespace HexagonII { |
Sirish Pande | 545983e | 2012-02-09 15:20:33 +0000 | [diff] [blame] | 29 | // *** The code below must match HexagonInstrFormat*.td *** // |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 30 | |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 31 | // Insn types. |
| 32 | // *** Must match HexagonInstrFormat*.td *** |
| 33 | enum Type { |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 34 | TypePSEUDO = 0, |
| 35 | TypeALU32 = 1, |
| 36 | TypeCR = 2, |
| 37 | TypeJR = 3, |
| 38 | TypeJ = 4, |
| 39 | TypeLD = 5, |
| 40 | TypeST = 6, |
| 41 | TypeSYSTEM = 7, |
| 42 | TypeXTYPE = 8, |
| 43 | TypeMEMOP = 9, |
| 44 | TypeNV = 10, |
| 45 | TypePREFIX = 30, // Such as extenders. |
| 46 | TypeENDLOOP = 31 // Such as end of a HW loop. |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 49 | enum SubTarget { |
| 50 | HasV2SubT = 0xf, |
| 51 | HasV2SubTOnly = 0x1, |
| 52 | NoV2SubT = 0x0, |
| 53 | HasV3SubT = 0xe, |
| 54 | HasV3SubTOnly = 0x2, |
| 55 | NoV3SubT = 0x1, |
| 56 | HasV4SubT = 0xc, |
| 57 | NoV4SubT = 0x3, |
| 58 | HasV5SubT = 0x8, |
| 59 | NoV5SubT = 0x7 |
| 60 | }; |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 61 | |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 62 | enum AddrMode { |
| 63 | NoAddrMode = 0, // No addressing mode |
| 64 | Absolute = 1, // Absolute addressing mode |
| 65 | AbsoluteSet = 2, // Absolute set addressing mode |
| 66 | BaseImmOffset = 3, // Indirect with offset |
| 67 | BaseLongOffset = 4, // Indirect with long offset |
Jyotsna Verma | a03eb9b | 2013-05-07 15:06:29 +0000 | [diff] [blame] | 68 | BaseRegOffset = 5, // Indirect with register offset |
| 69 | PostInc = 6 // Post increment addressing mode |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 70 | }; |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 71 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 72 | enum MemAccessSize { |
| 73 | NoMemAccess = 0, // Not a memory acces instruction. |
| 74 | ByteAccess = 1, // Byte access instruction (memb). |
| 75 | HalfWordAccess = 2, // Half word access instruction (memh). |
Robert Wilhelm | 2788d3e | 2013-09-28 13:42:22 +0000 | [diff] [blame] | 76 | WordAccess = 3, // Word access instruction (memw). |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 77 | DoubleWordAccess = 4 // Double word access instruction (memd) |
| 78 | }; |
| 79 | |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 80 | // MCInstrDesc TSFlags |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 81 | // *** Must match HexagonInstrFormat*.td *** |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 82 | enum { |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 83 | // This 5-bit field describes the insn type. |
| 84 | TypePos = 0, |
| 85 | TypeMask = 0x1f, |
| 86 | |
| 87 | // Solo instructions. |
| 88 | SoloPos = 5, |
| 89 | SoloMask = 0x1, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 90 | // Packed only with A or X-type instructions. |
| 91 | SoloAXPos = 6, |
| 92 | SoloAXMask = 0x1, |
| 93 | // Only A-type instruction in first slot or nothing. |
| 94 | SoloAin1Pos = 7, |
| 95 | SoloAin1Mask = 0x1, |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 96 | |
| 97 | // Predicated instructions. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 98 | PredicatedPos = 8, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 99 | PredicatedMask = 0x1, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 100 | PredicatedFalsePos = 9, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 101 | PredicatedFalseMask = 0x1, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 102 | PredicatedNewPos = 10, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 103 | PredicatedNewMask = 0x1, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 104 | PredicateLatePos = 11, |
| 105 | PredicateLateMask = 0x1, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 106 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 107 | // New-Value consumer instructions. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 108 | NewValuePos = 12, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 109 | NewValueMask = 0x1, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 110 | // New-Value producer instructions. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 111 | hasNewValuePos = 13, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 112 | hasNewValueMask = 0x1, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 113 | // Which operand consumes or produces a new value. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 114 | NewValueOpPos = 14, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 115 | NewValueOpMask = 0x7, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 116 | // Stores that can become new-value stores. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 117 | mayNVStorePos = 17, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 118 | mayNVStoreMask = 0x1, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 119 | // New-value store instructions. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 120 | NVStorePos = 18, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 121 | NVStoreMask = 0x1, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 122 | // Loads that can become current-value loads. |
| 123 | mayCVLoadPos = 19, |
| 124 | mayCVLoadMask = 0x1, |
| 125 | // Current-value load instructions. |
| 126 | CVLoadPos = 20, |
| 127 | CVLoadMask = 0x1, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 128 | |
| 129 | // Extendable insns. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 130 | ExtendablePos = 21, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 131 | ExtendableMask = 0x1, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 132 | // Insns must be extended. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 133 | ExtendedPos = 22, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 134 | ExtendedMask = 0x1, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 135 | // Which operand may be extended. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 136 | ExtendableOpPos = 23, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 137 | ExtendableOpMask = 0x7, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 138 | // Signed or unsigned range. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 139 | ExtentSignedPos = 26, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 140 | ExtentSignedMask = 0x1, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 141 | // Number of bits of range before extending operand. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 142 | ExtentBitsPos = 27, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 143 | ExtentBitsMask = 0x1f, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 144 | // Alignment power-of-two before extending operand. |
| 145 | ExtentAlignPos = 32, |
| 146 | ExtentAlignMask = 0x3, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 147 | |
| 148 | // Valid subtargets |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 149 | validSubTargetPos = 34, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 150 | validSubTargetMask = 0xf, |
| 151 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 152 | // Addressing mode for load/store instructions. |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 153 | AddrModePos = 40, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 154 | AddrModeMask = 0x7, |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 155 | // Access size for load/store instructions. |
| 156 | MemAccessSizePos = 43, |
| 157 | MemAccesSizeMask = 0x7, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 158 | |
Jyotsna Verma | f98a1ec | 2014-05-07 19:07:34 +0000 | [diff] [blame] | 159 | // Branch predicted taken. |
| 160 | TakenPos = 47, |
| 161 | TakenMask = 0x1, |
| 162 | |
| 163 | // Floating-point instructions. |
| 164 | FPPos = 48, |
| 165 | FPMask = 0x1 |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame] | 166 | }; |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 167 | |
Sirish Pande | 545983e | 2012-02-09 15:20:33 +0000 | [diff] [blame] | 168 | // *** The code above must match HexagonInstrFormat*.td *** // |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 169 | |
Jyotsna Verma | 8425643 | 2013-03-01 17:37:13 +0000 | [diff] [blame] | 170 | // Hexagon specific MO operand flag mask. |
| 171 | enum HexagonMOTargetFlagVal { |
| 172 | //===------------------------------------------------------------------===// |
| 173 | // Hexagon Specific MachineOperand flags. |
| 174 | MO_NO_FLAG, |
| 175 | |
| 176 | HMOTF_ConstExtended = 1, |
| 177 | |
| 178 | /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation |
| 179 | /// Used for computing a global address for PIC compilations |
| 180 | MO_PCREL, |
| 181 | |
| 182 | /// MO_GOT - Indicates a GOT-relative relocation |
| 183 | MO_GOT, |
| 184 | |
| 185 | // Low or high part of a symbol. |
| 186 | MO_LO16, MO_HI16, |
| 187 | |
| 188 | // Offset from the base of the SDA. |
| 189 | MO_GPREL |
| 190 | }; |
| 191 | |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 192 | } // End namespace HexagonII. |
| 193 | |
| 194 | } // End namespace llvm. |
| 195 | |
| 196 | #endif |