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 | |
| 17 | #ifndef HEXAGONBASEINFO_H |
| 18 | #define HEXAGONBASEINFO_H |
| 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 |
| 68 | BaseRegOffset = 5 // Indirect with register offset |
| 69 | }; |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 70 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 71 | enum MemAccessSize { |
| 72 | NoMemAccess = 0, // Not a memory acces instruction. |
| 73 | ByteAccess = 1, // Byte access instruction (memb). |
| 74 | HalfWordAccess = 2, // Half word access instruction (memh). |
| 75 | WordAccess = 3, // Word access instrution (memw). |
| 76 | DoubleWordAccess = 4 // Double word access instruction (memd) |
| 77 | }; |
| 78 | |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 79 | // MCInstrDesc TSFlags |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 80 | // *** Must match HexagonInstrFormat*.td *** |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 81 | enum { |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 82 | // This 5-bit field describes the insn type. |
| 83 | TypePos = 0, |
| 84 | TypeMask = 0x1f, |
| 85 | |
| 86 | // Solo instructions. |
| 87 | SoloPos = 5, |
| 88 | SoloMask = 0x1, |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 89 | |
| 90 | // Predicated instructions. |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 91 | PredicatedPos = 6, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 92 | PredicatedMask = 0x1, |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 93 | PredicatedFalsePos = 7, |
| 94 | PredicatedFalseMask = 0x1, |
| 95 | PredicatedNewPos = 8, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 96 | PredicatedNewMask = 0x1, |
| 97 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 98 | // New-Value consumer instructions. |
| 99 | NewValuePos = 9, |
| 100 | NewValueMask = 0x1, |
| 101 | |
| 102 | // New-Value producer instructions. |
| 103 | hasNewValuePos = 10, |
| 104 | hasNewValueMask = 0x1, |
| 105 | |
| 106 | // Which operand consumes or produces a new value. |
| 107 | NewValueOpPos = 11, |
| 108 | NewValueOpMask = 0x7, |
| 109 | |
| 110 | // Which bits encode the new value. |
| 111 | NewValueBitsPos = 14, |
| 112 | NewValueBitsMask = 0x3, |
| 113 | |
| 114 | // Stores that can become new-value stores. |
| 115 | mayNVStorePos = 16, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 116 | mayNVStoreMask = 0x1, |
| 117 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 118 | // New-value store instructions. |
| 119 | NVStorePos = 17, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 120 | NVStoreMask = 0x1, |
| 121 | |
| 122 | // Extendable insns. |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 123 | ExtendablePos = 18, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 124 | ExtendableMask = 0x1, |
| 125 | |
| 126 | // Insns must be extended. |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 127 | ExtendedPos = 19, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 128 | ExtendedMask = 0x1, |
| 129 | |
| 130 | // Which operand may be extended. |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 131 | ExtendableOpPos = 20, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 132 | ExtendableOpMask = 0x7, |
| 133 | |
| 134 | // Signed or unsigned range. |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 135 | ExtentSignedPos = 23, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 136 | ExtentSignedMask = 0x1, |
| 137 | |
| 138 | // Number of bits of range before extending operand. |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 139 | ExtentBitsPos = 24, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 140 | ExtentBitsMask = 0x1f, |
| 141 | |
| 142 | // Valid subtargets |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 143 | validSubTargetPos = 29, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 144 | validSubTargetMask = 0xf, |
| 145 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 146 | // Addressing mode for load/store instructions. |
| 147 | AddrModePos = 33, |
| 148 | AddrModeMask = 0x7, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 149 | |
Jyotsna Verma | e758da2 | 2013-02-19 18:18:36 +0000 | [diff] [blame^] | 150 | // Access size of memory access instructions (load/store). |
| 151 | MemAccessSizePos = 36, |
| 152 | MemAccesSizeMask = 0x7 |
| 153 | }; |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 154 | |
Sirish Pande | 545983e | 2012-02-09 15:20:33 +0000 | [diff] [blame] | 155 | // *** The code above must match HexagonInstrFormat*.td *** // |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 156 | |
| 157 | } // End namespace HexagonII. |
| 158 | |
| 159 | } // End namespace llvm. |
| 160 | |
| 161 | #endif |