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 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | /// HexagonII - This namespace holds all of the target specific flags that |
| 23 | /// instruction info tracks. |
| 24 | /// |
| 25 | namespace HexagonII { |
Sirish Pande | 545983e | 2012-02-09 15:20:33 +0000 | [diff] [blame] | 26 | // *** The code below must match HexagonInstrFormat*.td *** // |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 27 | |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 28 | // Insn types. |
| 29 | // *** Must match HexagonInstrFormat*.td *** |
| 30 | enum Type { |
| 31 | TypePSEUDO = 0, |
| 32 | TypeALU32 = 1, |
| 33 | TypeCR = 2, |
| 34 | TypeJR = 3, |
| 35 | TypeJ = 4, |
| 36 | TypeLD = 5, |
| 37 | TypeST = 6, |
| 38 | TypeSYSTEM = 7, |
| 39 | TypeXTYPE = 8, |
| 40 | TypeMEMOP = 9, |
| 41 | TypeNV = 10, |
| 42 | TypePREFIX = 30, // Such as extenders. |
| 43 | TypeMARKER = 31 // Such as end of a HW loop. |
| 44 | }; |
| 45 | |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 46 | enum SubTarget { |
| 47 | HasV2SubT = 0xf, |
| 48 | HasV2SubTOnly = 0x1, |
| 49 | NoV2SubT = 0x0, |
| 50 | HasV3SubT = 0xe, |
| 51 | HasV3SubTOnly = 0x2, |
| 52 | NoV3SubT = 0x1, |
| 53 | HasV4SubT = 0xc, |
| 54 | NoV4SubT = 0x3, |
| 55 | HasV5SubT = 0x8, |
| 56 | NoV5SubT = 0x7 |
| 57 | }; |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 58 | |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 59 | enum AddrMode { |
| 60 | NoAddrMode = 0, // No addressing mode |
| 61 | Absolute = 1, // Absolute addressing mode |
| 62 | AbsoluteSet = 2, // Absolute set addressing mode |
| 63 | BaseImmOffset = 3, // Indirect with offset |
| 64 | BaseLongOffset = 4, // Indirect with long offset |
| 65 | BaseRegOffset = 5 // Indirect with register offset |
| 66 | }; |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 67 | |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 68 | // MCInstrDesc TSFlags |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 69 | // *** Must match HexagonInstrFormat*.td *** |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 70 | enum { |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 71 | // This 5-bit field describes the insn type. |
| 72 | TypePos = 0, |
| 73 | TypeMask = 0x1f, |
| 74 | |
| 75 | // Solo instructions. |
| 76 | SoloPos = 5, |
| 77 | SoloMask = 0x1, |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 78 | |
| 79 | // Predicated instructions. |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 80 | PredicatedPos = 6, |
Jyotsna Verma | 6649360 | 2012-11-14 20:38:48 +0000 | [diff] [blame] | 81 | PredicatedMask = 0x1, |
| 82 | PredicatedNewPos = 7, |
| 83 | PredicatedNewMask = 0x1, |
| 84 | |
| 85 | // Stores that can be newified. |
| 86 | mayNVStorePos = 8, |
| 87 | mayNVStoreMask = 0x1, |
| 88 | |
| 89 | // Dot new value store instructions. |
| 90 | NVStorePos = 9, |
| 91 | NVStoreMask = 0x1, |
| 92 | |
| 93 | // Extendable insns. |
| 94 | ExtendablePos = 10, |
| 95 | ExtendableMask = 0x1, |
| 96 | |
| 97 | // Insns must be extended. |
| 98 | ExtendedPos = 11, |
| 99 | ExtendedMask = 0x1, |
| 100 | |
| 101 | // Which operand may be extended. |
| 102 | ExtendableOpPos = 12, |
| 103 | ExtendableOpMask = 0x7, |
| 104 | |
| 105 | // Signed or unsigned range. |
| 106 | ExtentSignedPos = 15, |
| 107 | ExtentSignedMask = 0x1, |
| 108 | |
| 109 | // Number of bits of range before extending operand. |
| 110 | ExtentBitsPos = 16, |
| 111 | ExtentBitsMask = 0x1f, |
| 112 | |
| 113 | // Valid subtargets |
| 114 | validSubTargetPos = 21, |
| 115 | validSubTargetMask = 0xf, |
| 116 | |
| 117 | // Addressing mode for load/store instructions |
| 118 | AddrModePos = 25, |
| 119 | AddrModeMask = 0xf |
| 120 | |
| 121 | }; |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 122 | |
Sirish Pande | 545983e | 2012-02-09 15:20:33 +0000 | [diff] [blame] | 123 | // *** The code above must match HexagonInstrFormat*.td *** // |
Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 124 | |
| 125 | } // End namespace HexagonII. |
| 126 | |
| 127 | } // End namespace llvm. |
| 128 | |
| 129 | #endif |