blob: a90db2384c466422b5558e10695a4059bd60d56d [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
Daniel Sandersfe98b2f2016-05-03 13:35:44 +000036 /// MO_GOT - 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.
38 MO_GOT,
39
40 /// MO_GOT_CALL - Represents the offset into the global offset table at
41 /// which the address of a call site relocation entry symbol resides
42 /// during execution. This is different from the above since this flag
43 /// can only be present in call instructions.
44 MO_GOT_CALL,
45
46 /// MO_GPREL - Represents the offset from the current gp value to be used
47 /// for the relocatable object file being produced.
48 MO_GPREL,
49
50 /// MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol
51 /// address.
52 MO_ABS_HI,
53 MO_ABS_LO,
54
55 /// MO_TLSGD - Represents the offset into the global offset table at which
56 // the module ID and TSL block offset reside during execution (General
57 // Dynamic TLS).
58 MO_TLSGD,
59
Akira Hatanakabff84e12011-12-14 18:26:41 +000060 /// MO_TLSLDM - Represents the offset into the global offset table at which
61 // the module ID and TSL block offset reside during execution (Local
62 // Dynamic TLS).
63 MO_TLSLDM,
64 MO_DTPREL_HI,
65 MO_DTPREL_LO,
66
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000067 /// MO_GOTTPREL - Represents the offset from the thread pointer (Initial
68 // Exec TLS).
69 MO_GOTTPREL,
70
71 /// MO_TPREL_HI/LO - Represents the hi and low part of the offset from
72 // the thread pointer (Local Exec TLS).
73 MO_TPREL_HI,
74 MO_TPREL_LO,
75
76 // N32/64 Flags.
77 MO_GPOFF_HI,
78 MO_GPOFF_LO,
79 MO_GOT_DISP,
80 MO_GOT_PAGE,
Akira Hatanaka6035fe72012-07-21 03:09:04 +000081 MO_GOT_OFST,
82
Akira Hatanakaadec58c2012-07-23 19:19:20 +000083 /// MO_HIGHER/HIGHEST - Represents the highest or higher half word of a
84 /// 64-bit symbol address.
Akira Hatanaka6035fe72012-07-21 03:09:04 +000085 MO_HIGHER,
Akira Hatanaka03fb5b92012-11-21 19:59:51 +000086 MO_HIGHEST,
87
88 /// MO_GOT_HI16/LO16, MO_CALL_HI16/LO16 - Relocations used for large GOTs.
89 MO_GOT_HI16,
90 MO_GOT_LO16,
91 MO_CALL_HI16,
92 MO_CALL_LO16
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000093 };
94
95 enum {
96 //===------------------------------------------------------------------===//
97 // Instruction encodings. These are the standard/most common forms for
98 // Mips instructions.
99 //
100
101 // Pseudo - This represents an instruction that is a pseudo instruction
102 // or one that has not been implemented yet. It is illegal to code generate
103 // it, but tolerated for intermediate implementation stages.
104 Pseudo = 0,
105
106 /// FrmR - This form is for instructions of the format R.
107 FrmR = 1,
108 /// FrmI - This form is for instructions of the format I.
109 FrmI = 2,
110 /// FrmJ - This form is for instructions of the format J.
111 FrmJ = 3,
112 /// FrmFR - This form is for instructions of the format FR.
113 FrmFR = 4,
114 /// FrmFI - This form is for instructions of the format FI.
115 FrmFI = 5,
116 /// FrmOther - This form is for instructions that have no specific format.
117 FrmOther = 6,
118
Daniel Sanderse8efff32016-03-14 16:24:05 +0000119 FormMask = 15,
120 /// IsCTI - Instruction is a Control Transfer Instruction.
121 IsCTI = 1 << 4,
122 /// HasForbiddenSlot - Instruction has a forbidden slot.
Hrvoje Vargadbe4d962016-09-08 07:41:43 +0000123 HasForbiddenSlot = 1 << 5,
124 /// IsPCRelativeLoad - A Load instruction with implicit source register
125 /// ($pc) with explicit offset and destination register
Simon Dardis730fdb72017-01-16 13:55:58 +0000126 IsPCRelativeLoad = 1 << 6,
127 /// HasFCCRegOperand - Instruction uses an $fcc<x> register.
128 HasFCCRegOperand = 1 << 7
Daniel Sanderse8efff32016-03-14 16:24:05 +0000129
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000130 };
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000131}
132}
Akira Hatanakad9ea7c82011-10-14 03:04:24 +0000133
134#endif