blob: 9fc826f412cbbabf3ad56ba0b2dca5e3d8a0f89c [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- HexagonBaseInfo.h - Top level definitions for Hexagon --*- C++ -*--===//
Brendon Cahoon6f358372012-02-08 18:25:47 +00002//
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
20namespace llvm {
21
22/// HexagonII - This namespace holds all of the target specific flags that
23/// instruction info tracks.
24///
25namespace HexagonII {
Sirish Pande545983e2012-02-09 15:20:33 +000026 // *** The code below must match HexagonInstrFormat*.td *** //
Brendon Cahoon6f358372012-02-08 18:25:47 +000027
Sirish Pandef8e5e3c2012-05-03 21:52:53 +000028 // 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 Verma66493602012-11-14 20:38:48 +000046 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 Pandef8e5e3c2012-05-03 21:52:53 +000058
Jyotsna Verma66493602012-11-14 20:38:48 +000059 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 Pandef8e5e3c2012-05-03 21:52:53 +000067
Brendon Cahoon6f358372012-02-08 18:25:47 +000068 // MCInstrDesc TSFlags
Sirish Pandef8e5e3c2012-05-03 21:52:53 +000069 // *** Must match HexagonInstrFormat*.td ***
Brendon Cahoon6f358372012-02-08 18:25:47 +000070 enum {
Sirish Pandef8e5e3c2012-05-03 21:52:53 +000071 // 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 Cahoon6f358372012-02-08 18:25:47 +000078
79 // Predicated instructions.
Sirish Pandef8e5e3c2012-05-03 21:52:53 +000080 PredicatedPos = 6,
Jyotsna Verma66493602012-11-14 20:38:48 +000081 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 Cahoon6f358372012-02-08 18:25:47 +0000122
Sirish Pande545983e2012-02-09 15:20:33 +0000123 // *** The code above must match HexagonInstrFormat*.td *** //
Brendon Cahoon6f358372012-02-08 18:25:47 +0000124
125} // End namespace HexagonII.
126
127} // End namespace llvm.
128
129#endif