blob: 2e3d2f48a928f648fd27d5e847e8bb1bd78d6df3 [file] [log] [blame]
Chris Lattnerec352402004-08-01 05:04:00 +00001//===- CodeGenInstruction.h - Instruction Class Wrapper ---------*- C++ -*-===//
Misha Brukman3da94ae2005-04-22 00:00:37 +00002//
Chris Lattnerec352402004-08-01 05:04:00 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner30609102007-12-29 20:37:13 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman3da94ae2005-04-22 00:00:37 +00007//
Chris Lattnerec352402004-08-01 05:04:00 +00008//===----------------------------------------------------------------------===//
9//
10// This file defines a wrapper class for the 'Instruction' TableGen class.
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramer00e08fc2014-08-13 16:26:38 +000014#ifndef LLVM_UTILS_TABLEGEN_CODEGENINSTRUCTION_H
15#define LLVM_UTILS_TABLEGEN_CODEGENINSTRUCTION_H
Chris Lattnerec352402004-08-01 05:04:00 +000016
Chris Lattner225549f2010-11-06 06:39:47 +000017#include "llvm/ADT/StringRef.h"
David Blaikie9d9a46a2018-03-23 23:58:25 +000018#include "llvm/Support/MachineValueType.h"
Craig Topper0547b622015-06-08 01:35:40 +000019#include "llvm/Support/SMLoc.h"
Chris Lattnerec352402004-08-01 05:04:00 +000020#include <string>
Chris Lattnerec352402004-08-01 05:04:00 +000021#include <utility>
Chandler Carruth4ffd89f2012-12-04 10:37:14 +000022#include <vector>
Chris Lattnerec352402004-08-01 05:04:00 +000023
24namespace llvm {
Mehdi Aminif6071e12016-04-18 09:17:29 +000025template <typename T> class ArrayRef;
Chris Lattnerec352402004-08-01 05:04:00 +000026 class Record;
Chris Lattner65303d62005-11-19 07:05:57 +000027 class DagInit;
Chris Lattner9414ae52010-03-27 20:09:24 +000028 class CodeGenTarget;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000029
Chris Lattnerc240bb02010-11-01 04:03:32 +000030 class CGIOperandList {
Jeff Cohend41b30d2006-11-05 19:31:28 +000031 public:
Chris Lattnera7d479c2010-02-10 01:45:28 +000032 class ConstraintInfo {
33 enum { None, EarlyClobber, Tied } Kind;
34 unsigned OtherTiedOperand;
35 public:
36 ConstraintInfo() : Kind(None) {}
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000037
Chris Lattnera7d479c2010-02-10 01:45:28 +000038 static ConstraintInfo getEarlyClobber() {
39 ConstraintInfo I;
40 I.Kind = EarlyClobber;
Chris Lattnere555c9f2010-02-10 21:22:51 +000041 I.OtherTiedOperand = 0;
Chris Lattnera7d479c2010-02-10 01:45:28 +000042 return I;
43 }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000044
Chris Lattnera7d479c2010-02-10 01:45:28 +000045 static ConstraintInfo getTied(unsigned Op) {
46 ConstraintInfo I;
47 I.Kind = Tied;
48 I.OtherTiedOperand = Op;
49 return I;
50 }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000051
Chris Lattnera7d479c2010-02-10 01:45:28 +000052 bool isNone() const { return Kind == None; }
53 bool isEarlyClobber() const { return Kind == EarlyClobber; }
54 bool isTied() const { return Kind == Tied; }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000055
Chris Lattnera7d479c2010-02-10 01:45:28 +000056 unsigned getTiedOperand() const {
57 assert(isTied());
58 return OtherTiedOperand;
59 }
Simon Tatham4b88bad2018-11-28 11:43:49 +000060
61 bool operator==(const ConstraintInfo &RHS) const {
62 if (Kind != RHS.Kind)
63 return false;
64 if (Kind == Tied && OtherTiedOperand != RHS.OtherTiedOperand)
65 return false;
66 return true;
67 }
Haojian Wu9d5ac662018-11-28 12:32:53 +000068 bool operator!=(const ConstraintInfo &RHS) const {
69 return !(*this == RHS);
70 }
Chris Lattnera7d479c2010-02-10 01:45:28 +000071 };
Jim Grosbach9ed2cee2010-10-08 18:09:59 +000072
Chris Lattnercf03da02004-08-11 02:22:39 +000073 /// OperandInfo - The information we keep track of for each operand in the
74 /// operand list for a tablegen instruction.
Chris Lattner87c59052004-08-01 07:42:39 +000075 struct OperandInfo {
Chris Lattnercf03da02004-08-11 02:22:39 +000076 /// Rec - The definition this operand is declared as.
Chris Lattner0e384b62005-08-19 16:57:28 +000077 ///
Chris Lattner87c59052004-08-01 07:42:39 +000078 Record *Rec;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000079
Chris Lattnercf03da02004-08-11 02:22:39 +000080 /// Name - If this operand was assigned a symbolic name, this is it,
81 /// otherwise, it's empty.
Chris Lattner87c59052004-08-01 07:42:39 +000082 std::string Name;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000083
Chris Lattnercf03da02004-08-11 02:22:39 +000084 /// PrinterMethodName - The method used to print operands of this type in
85 /// the asmprinter.
86 std::string PrinterMethodName;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000087
Jim Grosbach5013f742010-10-12 22:21:57 +000088 /// EncoderMethodName - The method used to get the machine operand value
89 /// for binary encoding. "getMachineOpValue" by default.
90 std::string EncoderMethodName;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +000091
Benjamin Kramer5196c122011-07-14 21:47:18 +000092 /// OperandType - A value from MCOI::OperandType representing the type of
93 /// the operand.
94 std::string OperandType;
95
Chris Lattnercf03da02004-08-11 02:22:39 +000096 /// MIOperandNo - Currently (this is meant to be phased out), some logical
97 /// operands correspond to multiple MachineInstr operands. In the X86
98 /// target for example, one address operand is represented as 4
99 /// MachineOperands. Because of this, the operand number in the
100 /// OperandList may not match the MachineInstr operand num. Until it
101 /// does, this contains the MI operand index of this operand.
102 unsigned MIOperandNo;
Chris Lattnercfbf96a2005-08-18 23:38:41 +0000103 unsigned MINumOperands; // The number of operands.
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000104
Chris Lattnerf64f9a42006-11-15 23:23:02 +0000105 /// DoNotEncode - Bools are set to true in this vector for each operand in
106 /// the DisableEncoding list. These should not be emitted by the code
107 /// emitter.
108 std::vector<bool> DoNotEncode;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000109
Nate Begeman8ef9d162005-11-30 23:58:18 +0000110 /// MIOperandInfo - Default MI operand type. Note an operand may be made
111 /// up of multiple MI operands.
David Greene05bce0b2011-07-29 22:43:06 +0000112 DagInit *MIOperandInfo;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000113
Chris Lattner0bb75002006-11-15 02:38:17 +0000114 /// Constraint info for this operand. This operand can have pieces, so we
115 /// track constraint info for each.
Chris Lattnera7d479c2010-02-10 01:45:28 +0000116 std::vector<ConstraintInfo> Constraints;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000117
Jim Grosbach9ed2cee2010-10-08 18:09:59 +0000118 OperandInfo(Record *R, const std::string &N, const std::string &PMN,
Benjamin Kramer5196c122011-07-14 21:47:18 +0000119 const std::string &EMN, const std::string &OT, unsigned MION,
David Greene05bce0b2011-07-29 22:43:06 +0000120 unsigned MINO, DagInit *MIOI)
Chris Lattnerc240bb02010-11-01 04:03:32 +0000121 : Rec(R), Name(N), PrinterMethodName(PMN), EncoderMethodName(EMN),
Benjamin Kramer5196c122011-07-14 21:47:18 +0000122 OperandType(OT), MIOperandNo(MION), MINumOperands(MINO),
123 MIOperandInfo(MIOI) {}
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000124
125
Chris Lattner9b0d4bf2010-11-02 22:55:03 +0000126 /// getTiedOperand - If this operand is tied to another one, return the
127 /// other operand number. Otherwise, return -1.
128 int getTiedRegister() const {
129 for (unsigned j = 0, e = Constraints.size(); j != e; ++j) {
130 const CGIOperandList::ConstraintInfo &CI = Constraints[j];
131 if (CI.isTied()) return CI.getTiedOperand();
132 }
133 return -1;
134 }
Chris Lattner87c59052004-08-01 07:42:39 +0000135 };
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000136
Chris Lattnerc240bb02010-11-01 04:03:32 +0000137 CGIOperandList(Record *D);
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000138
Chris Lattnerc240bb02010-11-01 04:03:32 +0000139 Record *TheDef; // The actual record containing this OperandList.
Misha Brukman3da94ae2005-04-22 00:00:37 +0000140
Chris Lattnercedef1c2010-03-18 20:50:52 +0000141 /// NumDefs - Number of def operands declared, this is the number of
142 /// elements in the instruction's (outs) list.
Evan Cheng64d80e32007-07-19 01:14:50 +0000143 ///
144 unsigned NumDefs;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000145
Chris Lattnerec352402004-08-01 05:04:00 +0000146 /// OperandList - The list of declared operands, along with their declared
147 /// type (which is a record).
Chris Lattner87c59052004-08-01 07:42:39 +0000148 std::vector<OperandInfo> OperandList;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000149
Chris Lattnerc240bb02010-11-01 04:03:32 +0000150 // Information gleaned from the operand list.
151 bool isPredicable;
152 bool hasOptionalDef;
153 bool isVariadic;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000154
Chris Lattnerc240bb02010-11-01 04:03:32 +0000155 // Provide transparent accessors to the operand list.
Chris Lattnera90dbc12011-04-17 22:24:13 +0000156 bool empty() const { return OperandList.empty(); }
Chris Lattnerc240bb02010-11-01 04:03:32 +0000157 unsigned size() const { return OperandList.size(); }
158 const OperandInfo &operator[](unsigned i) const { return OperandList[i]; }
159 OperandInfo &operator[](unsigned i) { return OperandList[i]; }
160 OperandInfo &back() { return OperandList.back(); }
161 const OperandInfo &back() const { return OperandList.back(); }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000162
Jim Grosbach3db76cc2014-04-18 02:08:58 +0000163 typedef std::vector<OperandInfo>::iterator iterator;
164 typedef std::vector<OperandInfo>::const_iterator const_iterator;
165 iterator begin() { return OperandList.begin(); }
166 const_iterator begin() const { return OperandList.begin(); }
167 iterator end() { return OperandList.end(); }
168 const_iterator end() const { return OperandList.end(); }
169
Chris Lattnerc240bb02010-11-01 04:03:32 +0000170 /// getOperandNamed - Return the index of the operand with the specified
171 /// non-empty name. If the instruction does not have an operand with the
Joerg Sonnenberger61131ab2012-10-25 20:33:17 +0000172 /// specified name, abort.
Chris Lattnerc240bb02010-11-01 04:03:32 +0000173 unsigned getOperandNamed(StringRef Name) const;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000174
Chris Lattnerc240bb02010-11-01 04:03:32 +0000175 /// hasOperandNamed - Query whether the instruction has an operand of the
176 /// given name. If so, return true and set OpIdx to the index of the
177 /// operand. Otherwise, return false.
178 bool hasOperandNamed(StringRef Name, unsigned &OpIdx) const;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000179
Chris Lattnerc240bb02010-11-01 04:03:32 +0000180 /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar",
181 /// where $foo is a whole operand and $foo.bar refers to a suboperand.
Joerg Sonnenberger61131ab2012-10-25 20:33:17 +0000182 /// This aborts if the name is invalid. If AllowWholeOp is true, references
183 /// to operands with suboperands are allowed, otherwise not.
Chris Lattnerc240bb02010-11-01 04:03:32 +0000184 std::pair<unsigned,unsigned> ParseOperandName(const std::string &Op,
185 bool AllowWholeOp = true);
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000186
Chris Lattnerc240bb02010-11-01 04:03:32 +0000187 /// getFlattenedOperandNumber - Flatten a operand/suboperand pair into a
188 /// flat machineinstr operand #.
189 unsigned getFlattenedOperandNumber(std::pair<unsigned,unsigned> Op) const {
190 return OperandList[Op.first].MIOperandNo + Op.second;
191 }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000192
Chris Lattnerc240bb02010-11-01 04:03:32 +0000193 /// getSubOperandNumber - Unflatten a operand number into an
194 /// operand/suboperand pair.
195 std::pair<unsigned,unsigned> getSubOperandNumber(unsigned Op) const {
196 for (unsigned i = 0; ; ++i) {
197 assert(i < OperandList.size() && "Invalid flat operand #");
198 if (OperandList[i].MIOperandNo+OperandList[i].MINumOperands > Op)
199 return std::make_pair(i, Op-OperandList[i].MIOperandNo);
200 }
201 }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000202
203
Chris Lattnerc240bb02010-11-01 04:03:32 +0000204 /// isFlatOperandNotEmitted - Return true if the specified flat operand #
205 /// should not be emitted with the code emitter.
206 bool isFlatOperandNotEmitted(unsigned FlatOpNo) const {
207 std::pair<unsigned,unsigned> Op = getSubOperandNumber(FlatOpNo);
208 if (OperandList[Op.first].DoNotEncode.size() > Op.second)
209 return OperandList[Op.first].DoNotEncode[Op.second];
210 return false;
211 }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000212
Chris Lattnerc240bb02010-11-01 04:03:32 +0000213 void ProcessDisableEncoding(std::string Value);
214 };
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000215
Chris Lattnerc240bb02010-11-01 04:03:32 +0000216
217 class CodeGenInstruction {
218 public:
219 Record *TheDef; // The actual record defining this instruction.
Craig Topper77eddb72017-07-07 06:22:35 +0000220 StringRef Namespace; // The namespace the instruction is in.
Chris Lattnerc240bb02010-11-01 04:03:32 +0000221
222 /// AsmString - The format string used to emit a .s file for the
223 /// instruction.
224 std::string AsmString;
225
226 /// Operands - This is information about the (ins) and (outs) list specified
227 /// to the instruction.
228 CGIOperandList Operands;
Chris Lattnerec352402004-08-01 05:04:00 +0000229
Chris Lattnerf506b6b2010-03-18 21:42:03 +0000230 /// ImplicitDefs/ImplicitUses - These are lists of registers that are
231 /// implicitly defined and used by the instruction.
232 std::vector<Record*> ImplicitDefs, ImplicitUses;
233
Chris Lattnerec352402004-08-01 05:04:00 +0000234 // Various boolean values we track for the instruction.
Craig Topper51dd7652014-02-05 09:10:40 +0000235 bool isReturn : 1;
Heejin Ahn408053d2018-08-21 19:44:11 +0000236 bool isEHScopeReturn : 1;
Craig Topper51dd7652014-02-05 09:10:40 +0000237 bool isBranch : 1;
238 bool isIndirectBranch : 1;
239 bool isCompare : 1;
240 bool isMoveImm : 1;
Petar Jovanovic4d979512018-05-23 15:28:28 +0000241 bool isMoveReg : 1;
Craig Topper51dd7652014-02-05 09:10:40 +0000242 bool isBitcast : 1;
243 bool isSelect : 1;
244 bool isBarrier : 1;
245 bool isCall : 1;
Sjoerd Meijer82d457b2016-09-14 08:20:03 +0000246 bool isAdd : 1;
Joel Galenson83529882018-07-13 15:19:33 +0000247 bool isTrap : 1;
Craig Topper51dd7652014-02-05 09:10:40 +0000248 bool canFoldAsLoad : 1;
249 bool mayLoad : 1;
250 bool mayLoad_Unset : 1;
251 bool mayStore : 1;
252 bool mayStore_Unset : 1;
253 bool isPredicable : 1;
254 bool isConvertibleToThreeAddress : 1;
255 bool isCommutable : 1;
256 bool isTerminator : 1;
257 bool isReMaterializable : 1;
258 bool hasDelaySlot : 1;
259 bool usesCustomInserter : 1;
260 bool hasPostISelHook : 1;
261 bool hasCtrlDep : 1;
262 bool isNotDuplicable : 1;
263 bool hasSideEffects : 1;
264 bool hasSideEffects_Unset : 1;
Craig Topper51dd7652014-02-05 09:10:40 +0000265 bool isAsCheapAsAMove : 1;
266 bool hasExtraSrcRegAllocReq : 1;
267 bool hasExtraDefRegAllocReq : 1;
268 bool isCodeGenOnly : 1;
269 bool isPseudo : 1;
Quentin Colombet1b425402014-08-11 22:17:14 +0000270 bool isRegSequence : 1;
Quentin Colombetdac67642014-08-20 21:51:26 +0000271 bool isExtractSubreg : 1;
Quentin Colombet0d152132014-08-20 23:49:36 +0000272 bool isInsertSubreg : 1;
Owen Anderson2f6ca832015-05-28 18:33:39 +0000273 bool isConvergent : 1;
Matthias Braun279476d2016-03-01 20:03:11 +0000274 bool hasNoSchedulingInfo : 1;
Simon Dardisf690e9b2018-05-22 14:36:58 +0000275 bool FastISelShouldIgnore : 1;
Ulrich Weigand3a904262018-07-13 13:18:00 +0000276 bool hasChain : 1;
277 bool hasChain_Inferred : 1;
Oliver Stannard9639b462018-12-03 10:32:42 +0000278 bool variadicOpsAreDefs : 1;
Jim Grosbach9ed2cee2010-10-08 18:09:59 +0000279
Joey Gouly715d98d2013-09-12 10:28:05 +0000280 std::string DeprecatedReason;
281 bool HasComplexDeprecationPredicate;
282
Jakob Stoklund Olesen912519a2012-08-24 00:31:16 +0000283 /// Are there any undefined flags?
284 bool hasUndefFlags() const {
285 return mayLoad_Unset || mayStore_Unset || hasSideEffects_Unset;
286 }
287
288 // The record used to infer instruction flags, or NULL if no flag values
289 // have been inferred.
290 Record *InferredFrom;
Chris Lattnerec352402004-08-01 05:04:00 +0000291
Chris Lattnerf7808112010-11-01 02:15:23 +0000292 CodeGenInstruction(Record *R);
Chris Lattner87c59052004-08-01 07:42:39 +0000293
Chris Lattner9414ae52010-03-27 20:09:24 +0000294 /// HasOneImplicitDefWithKnownVT - If the instruction has at least one
295 /// implicit def and it has a known VT, return the VT, otherwise return
296 /// MVT::Other.
Jim Grosbach9ed2cee2010-10-08 18:09:59 +0000297 MVT::SimpleValueType
Chris Lattner9414ae52010-03-27 20:09:24 +0000298 HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000299
300
Chris Lattner4d43d0f2010-11-01 01:07:14 +0000301 /// FlattenAsmStringVariants - Flatten the specified AsmString to only
302 /// include text from the specified variant, returning the new string.
303 static std::string FlattenAsmStringVariants(StringRef AsmString,
304 unsigned Variant);
Daniel Sanders603ba132017-11-18 00:16:44 +0000305
306 // Is the specified operand in a generic instruction implicitly a pointer.
307 // This can be used on intructions that use typeN or ptypeN to identify
308 // operands that should be considered as pointers even though SelectionDAG
309 // didn't make a distinction between integer and pointers.
310 bool isOperandAPointer(unsigned i) const;
Chris Lattnerec352402004-08-01 05:04:00 +0000311 };
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000312
313
Chris Lattnerc76e80d2010-11-01 04:05:41 +0000314 /// CodeGenInstAlias - This represents an InstAlias definition.
315 class CodeGenInstAlias {
316 public:
317 Record *TheDef; // The actual record defining this InstAlias.
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000318
Chris Lattnerc76e80d2010-11-01 04:05:41 +0000319 /// AsmString - The format string used to emit a .s file for the
320 /// instruction.
321 std::string AsmString;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000322
Chris Lattnerb501d4f2010-11-01 05:34:34 +0000323 /// Result - The result instruction.
David Greene05bce0b2011-07-29 22:43:06 +0000324 DagInit *Result;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000325
Chris Lattner225549f2010-11-06 06:39:47 +0000326 /// ResultInst - The instruction generated by the alias (decoded from
327 /// Result).
328 CodeGenInstruction *ResultInst;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000329
330
Chris Lattner225549f2010-11-06 06:39:47 +0000331 struct ResultOperand {
Chris Lattner98c870f2010-11-06 19:25:43 +0000332 private:
Owen Anderson7e8921b2012-06-08 00:25:03 +0000333 std::string Name;
Chris Lattner225549f2010-11-06 06:39:47 +0000334 Record *R;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000335
Chris Lattner98c870f2010-11-06 19:25:43 +0000336 int64_t Imm;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000337 public:
Chris Lattner98c870f2010-11-06 19:25:43 +0000338 enum {
339 K_Record,
Chris Lattner90fd7972010-11-06 19:57:21 +0000340 K_Imm,
341 K_Reg
Chris Lattner98c870f2010-11-06 19:25:43 +0000342 } Kind;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000343
Benjamin Kramer14aae012016-05-27 14:27:24 +0000344 ResultOperand(std::string N, Record *r)
345 : Name(std::move(N)), R(r), Kind(K_Record) {}
Chris Lattner98c870f2010-11-06 19:25:43 +0000346 ResultOperand(int64_t I) : Imm(I), Kind(K_Imm) {}
Chris Lattner90fd7972010-11-06 19:57:21 +0000347 ResultOperand(Record *r) : R(r), Kind(K_Reg) {}
Chris Lattner98c870f2010-11-06 19:25:43 +0000348
349 bool isRecord() const { return Kind == K_Record; }
350 bool isImm() const { return Kind == K_Imm; }
Chris Lattner90fd7972010-11-06 19:57:21 +0000351 bool isReg() const { return Kind == K_Reg; }
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000352
Chris Lattner98c870f2010-11-06 19:25:43 +0000353 StringRef getName() const { assert(isRecord()); return Name; }
354 Record *getRecord() const { assert(isRecord()); return R; }
355 int64_t getImm() const { assert(isImm()); return Imm; }
Chris Lattner90fd7972010-11-06 19:57:21 +0000356 Record *getRegister() const { assert(isReg()); return R; }
Tim Northoverd0e93f22014-05-15 13:36:01 +0000357
358 unsigned getMINumOperands() const;
Chris Lattner225549f2010-11-06 06:39:47 +0000359 };
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000360
Chris Lattner225549f2010-11-06 06:39:47 +0000361 /// ResultOperands - The decoded operands for the result instruction.
362 std::vector<ResultOperand> ResultOperands;
Bob Wilson5e8f2a62011-01-20 18:38:02 +0000363
Bob Wilsona49c7df2011-01-26 19:44:55 +0000364 /// ResultInstOperandIndex - For each operand, this vector holds a pair of
365 /// indices to identify the corresponding operand in the result
366 /// instruction. The first index specifies the operand and the second
367 /// index specifies the suboperand. If there are no suboperands or if all
368 /// of them are matched by the operand, the second value should be -1.
369 std::vector<std::pair<unsigned, int> > ResultInstOperandIndex;
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000370
Craig Topper50ea5bb2018-06-18 01:28:01 +0000371 CodeGenInstAlias(Record *R, CodeGenTarget &T);
Bob Wilsona49c7df2011-01-26 19:44:55 +0000372
David Greene05bce0b2011-07-29 22:43:06 +0000373 bool tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
Jakob Stoklund Olesen376a8a72012-08-22 23:33:58 +0000374 Record *InstOpRec, bool hasSubOps, ArrayRef<SMLoc> Loc,
Bob Wilsona49c7df2011-01-26 19:44:55 +0000375 CodeGenTarget &T, ResultOperand &ResOp);
Jim Grosbach0c4d44a2011-03-14 17:32:49 +0000376 };
Chris Lattnerc76e80d2010-11-01 04:05:41 +0000377}
Chris Lattnerec352402004-08-01 05:04:00 +0000378
379#endif