blob: 0e54563b82528dabed7051587556859b24a62b72 [file] [log] [blame]
Jia Liu9d2d2ad2012-02-24 02:05:28 +00001//===-- MipsBaseInfo.h - Top level definitions for MIPS MC ------*- C++ -*-===//
Akira Hatanakad9ea7c82011-10-14 03:04:24 +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 Mips target useful for the compiler back-end and the MC libraries.
12//
13//===----------------------------------------------------------------------===//
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSBASEINFO_H
15#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSBASEINFO_H
Akira Hatanakad9ea7c82011-10-14 03:04:24 +000016
Akira Hatanakaa06bc1c2012-03-27 02:04:18 +000017#include "MipsFixupKinds.h"
Akira Hatanakad9ea7c82011-10-14 03:04:24 +000018#include "MipsMCTargetDesc.h"
Akira Hatanakaa06bc1c2012-03-27 02:04:18 +000019#include "llvm/MC/MCExpr.h"
Akira Hatanakad9ea7c82011-10-14 03:04:24 +000020#include "llvm/Support/DataTypes.h"
21#include "llvm/Support/ErrorHandling.h"
22
23namespace llvm {
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000024
25/// MipsII - This namespace holds all of the target specific flags that
26/// instruction info tracks.
27///
28namespace MipsII {
29 /// Target Operand Flag enum.
30 enum TOF {
31 //===------------------------------------------------------------------===//
32 // Mips Specific MachineOperand flags.
33
34 MO_NO_FLAG,
35
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000036 /// MO_GOT16 - Represents the offset into the global offset table at which
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000037 /// the address the relocation entry symbol resides during execution.
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000038 MO_GOT16,
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000039 MO_GOT,
40
41 /// MO_GOT_CALL - Represents the offset into the global offset table at
42 /// which the address of a call site relocation entry symbol resides
43 /// during execution. This is different from the above since this flag
44 /// can only be present in call instructions.
45 MO_GOT_CALL,
46
47 /// MO_GPREL - Represents the offset from the current gp value to be used
48 /// for the relocatable object file being produced.
49 MO_GPREL,
50
51 /// MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol
52 /// address.
53 MO_ABS_HI,
54 MO_ABS_LO,
55
56 /// MO_TLSGD - Represents the offset into the global offset table at which
57 // the module ID and TSL block offset reside during execution (General
58 // Dynamic TLS).
59 MO_TLSGD,
60
Akira Hatanakabff84e12011-12-14 18:26:41 +000061 /// MO_TLSLDM - Represents the offset into the global offset table at which
62 // the module ID and TSL block offset reside during execution (Local
63 // Dynamic TLS).
64 MO_TLSLDM,
65 MO_DTPREL_HI,
66 MO_DTPREL_LO,
67
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000068 /// MO_GOTTPREL - Represents the offset from the thread pointer (Initial
69 // Exec TLS).
70 MO_GOTTPREL,
71
72 /// MO_TPREL_HI/LO - Represents the hi and low part of the offset from
73 // the thread pointer (Local Exec TLS).
74 MO_TPREL_HI,
75 MO_TPREL_LO,
76
77 // N32/64 Flags.
78 MO_GPOFF_HI,
79 MO_GPOFF_LO,
80 MO_GOT_DISP,
81 MO_GOT_PAGE,
Akira Hatanaka6035fe72012-07-21 03:09:04 +000082 MO_GOT_OFST,
83
Akira Hatanakaadec58c2012-07-23 19:19:20 +000084 /// MO_HIGHER/HIGHEST - Represents the highest or higher half word of a
85 /// 64-bit symbol address.
Akira Hatanaka6035fe72012-07-21 03:09:04 +000086 MO_HIGHER,
Akira Hatanaka03fb5b92012-11-21 19:59:51 +000087 MO_HIGHEST,
88
89 /// MO_GOT_HI16/LO16, MO_CALL_HI16/LO16 - Relocations used for large GOTs.
90 MO_GOT_HI16,
91 MO_GOT_LO16,
92 MO_CALL_HI16,
93 MO_CALL_LO16
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000094 };
95
96 enum {
97 //===------------------------------------------------------------------===//
98 // Instruction encodings. These are the standard/most common forms for
99 // Mips instructions.
100 //
101
102 // Pseudo - This represents an instruction that is a pseudo instruction
103 // or one that has not been implemented yet. It is illegal to code generate
104 // it, but tolerated for intermediate implementation stages.
105 Pseudo = 0,
106
107 /// FrmR - This form is for instructions of the format R.
108 FrmR = 1,
109 /// FrmI - This form is for instructions of the format I.
110 FrmI = 2,
111 /// FrmJ - This form is for instructions of the format J.
112 FrmJ = 3,
113 /// FrmFR - This form is for instructions of the format FR.
114 FrmFR = 4,
115 /// FrmFI - This form is for instructions of the format FI.
116 FrmFI = 5,
117 /// FrmOther - This form is for instructions that have no specific format.
118 FrmOther = 6,
119
Daniel Sanderse8efff32016-03-14 16:24:05 +0000120 FormMask = 15,
121 /// IsCTI - Instruction is a Control Transfer Instruction.
122 IsCTI = 1 << 4,
123 /// HasForbiddenSlot - Instruction has a forbidden slot.
124 HasForbiddenSlot = 1 << 5
125
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000126 };
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000127}
128}
Akira Hatanakad9ea7c82011-10-14 03:04:24 +0000129
130#endif