LLVM  16.0.0git
InlineAsm.h
Go to the documentation of this file.
1 //===- llvm/InlineAsm.h - Class to represent inline asm strings -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class represents the inline asm strings, which are Value*'s that are
10 // used as the callee operand of call instructions. InlineAsm's are uniqued
11 // like constants, and created via InlineAsm::get(...).
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_INLINEASM_H
16 #define LLVM_IR_INLINEASM_H
17 
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/IR/Value.h"
21 #include <cassert>
22 #include <string>
23 #include <vector>
24 
25 namespace llvm {
26 
27 class Error;
28 class FunctionType;
29 class PointerType;
30 template <class ConstantClass> class ConstantUniqueMap;
31 
32 class InlineAsm final : public Value {
33 public:
34  enum AsmDialect {
37  };
38 
39 private:
40  friend struct InlineAsmKeyType;
42 
43  std::string AsmString, Constraints;
44  FunctionType *FTy;
45  bool HasSideEffects;
46  bool IsAlignStack;
47  AsmDialect Dialect;
48  bool CanThrow;
49 
50  InlineAsm(FunctionType *Ty, const std::string &AsmString,
51  const std::string &Constraints, bool hasSideEffects,
52  bool isAlignStack, AsmDialect asmDialect, bool canThrow);
53 
54  /// When the ConstantUniqueMap merges two types and makes two InlineAsms
55  /// identical, it destroys one of them with this method.
56  void destroyConstant();
57 
58 public:
59  InlineAsm(const InlineAsm &) = delete;
60  InlineAsm &operator=(const InlineAsm &) = delete;
61 
62  /// InlineAsm::get - Return the specified uniqued inline asm string.
63  ///
64  static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
65  StringRef Constraints, bool hasSideEffects,
66  bool isAlignStack = false,
67  AsmDialect asmDialect = AD_ATT, bool canThrow = false);
68 
69  bool hasSideEffects() const { return HasSideEffects; }
70  bool isAlignStack() const { return IsAlignStack; }
71  AsmDialect getDialect() const { return Dialect; }
72  bool canThrow() const { return CanThrow; }
73 
74  /// getType - InlineAsm's are always pointers.
75  ///
76  PointerType *getType() const {
77  return reinterpret_cast<PointerType*>(Value::getType());
78  }
79 
80  /// getFunctionType - InlineAsm's are always pointers to functions.
81  ///
83 
84  const std::string &getAsmString() const { return AsmString; }
85  const std::string &getConstraintString() const { return Constraints; }
86 
87  /// This static method can be used by the parser to check to see if the
88  /// specified constraint string is legal for the type.
89  static Error verify(FunctionType *Ty, StringRef Constraints);
90 
91  // Constraint String Parsing
93  isInput, // 'x'
94  isOutput, // '=x'
95  isClobber, // '~x'
96  isLabel, // '!x'
97  };
98 
99  using ConstraintCodeVector = std::vector<std::string>;
100 
102  /// MatchingInput - If this is not -1, this is an output constraint where an
103  /// input constraint is required to match it (e.g. "0"). The value is the
104  /// constraint number that matches this one (for example, if this is
105  /// constraint #0 and constraint #4 has the value "0", this will be 4).
106  int MatchingInput = -1;
107 
108  /// Code - The constraint code, either the register name (in braces) or the
109  /// constraint letter/number.
111 
112  /// Default constructor.
113  SubConstraintInfo() = default;
114  };
115 
116  using SubConstraintInfoVector = std::vector<SubConstraintInfo>;
117  struct ConstraintInfo;
118  using ConstraintInfoVector = std::vector<ConstraintInfo>;
119 
120  struct ConstraintInfo {
121  /// Type - The basic type of the constraint: input/output/clobber/label
122  ///
124 
125  /// isEarlyClobber - "&": output operand writes result before inputs are all
126  /// read. This is only ever set for an output operand.
127  bool isEarlyClobber = false;
128 
129  /// MatchingInput - If this is not -1, this is an output constraint where an
130  /// input constraint is required to match it (e.g. "0"). The value is the
131  /// constraint number that matches this one (for example, if this is
132  /// constraint #0 and constraint #4 has the value "0", this will be 4).
133  int MatchingInput = -1;
134 
135  /// hasMatchingInput - Return true if this is an output constraint that has
136  /// a matching input constraint.
137  bool hasMatchingInput() const { return MatchingInput != -1; }
138 
139  /// isCommutative - This is set to true for a constraint that is commutative
140  /// with the next operand.
141  bool isCommutative = false;
142 
143  /// isIndirect - True if this operand is an indirect operand. This means
144  /// that the address of the source or destination is present in the call
145  /// instruction, instead of it being returned or passed in explicitly. This
146  /// is represented with a '*' in the asm string.
147  bool isIndirect = false;
148 
149  /// Code - The constraint code, either the register name (in braces) or the
150  /// constraint letter/number.
152 
153  /// isMultipleAlternative - '|': has multiple-alternative constraints.
154  bool isMultipleAlternative = false;
155 
156  /// multipleAlternatives - If there are multiple alternative constraints,
157  /// this array will contain them. Otherwise it will be empty.
159 
160  /// The currently selected alternative constraint index.
162 
163  /// Default constructor.
164  ConstraintInfo() = default;
165 
166  /// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
167  /// fields in this structure. If the constraint string is not understood,
168  /// return true, otherwise return false.
169  bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar);
170 
171  /// selectAlternative - Point this constraint to the alternative constraint
172  /// indicated by the index.
173  void selectAlternative(unsigned index);
174 
175  /// Whether this constraint corresponds to an argument.
176  bool hasArg() const {
177  return Type == isInput || (Type == isOutput && isIndirect);
178  }
179  };
180 
181  /// ParseConstraints - Split up the constraint string into the specific
182  /// constraints and their prefixes. If this returns an empty vector, and if
183  /// the constraint string itself isn't empty, there was an error parsing.
184  static ConstraintInfoVector ParseConstraints(StringRef ConstraintString);
185 
186  /// ParseConstraints - Parse the constraints of this inlineasm object,
187  /// returning them the same way that ParseConstraints(str) does.
189  return ParseConstraints(Constraints);
190  }
191 
192  // Methods for support type inquiry through isa, cast, and dyn_cast:
193  static bool classof(const Value *V) {
194  return V->getValueID() == Value::InlineAsmVal;
195  }
196 
197  // These are helper methods for dealing with flags in the INLINEASM SDNode
198  // in the backend.
199  //
200  // The encoding of the flag word is currently:
201  // Bits 2-0 - A Kind_* value indicating the kind of the operand.
202  // Bits 15-3 - The number of SDNode operands associated with this inline
203  // assembly operand.
204  // If bit 31 is set:
205  // Bit 30-16 - The operand number that this operand must match.
206  // When bits 2-0 are Kind_Mem, the Constraint_* value must be
207  // obtained from the flags for this operand number.
208  // Else if bits 2-0 are Kind_Mem:
209  // Bit 30-16 - A Constraint_* value indicating the original constraint
210  // code.
211  // Else:
212  // Bit 30-16 - The register class ID to use for the operand.
213 
214  enum : uint32_t {
215  // Fixed operands on an INLINEASM SDNode.
219  Op_ExtraInfo = 3, // HasSideEffects, IsAlignStack, AsmDialect.
221 
222  // Fixed operands on an INLINEASM MachineInstr.
224  MIOp_ExtraInfo = 1, // HasSideEffects, IsAlignStack, AsmDialect.
226 
227  // Interpretation of the MIOp_ExtraInfo bit field.
234 
235  // Inline asm operands map to multiple SDNode / MachineInstr operands.
236  // The first operand is an immediate describing the asm operand, the low
237  // bits is the kind:
238  Kind_RegUse = 1, // Input register, "r".
239  Kind_RegDef = 2, // Output register, "=r".
240  Kind_RegDefEarlyClobber = 3, // Early-clobber output register, "=&r".
241  Kind_Clobber = 4, // Clobbered register, "~r".
242  Kind_Imm = 5, // Immediate.
243  Kind_Mem = 6, // Memory operand, "m", or an address, "p".
244 
245  // Memory constraint codes.
246  // These could be tablegenerated but there's little need to do that since
247  // there's plenty of space in the encoding to support the union of all
248  // constraint codes for all targets.
249  // Addresses are included here as they need to be treated the same by the
250  // backend, the only difference is that they are not used to actaully
251  // access memory by the instruction.
274 
275  // Address constraints
281 
284 
285  Flag_MatchingOperand = 0x80000000
286  };
287 
288  static unsigned getFlagWord(unsigned Kind, unsigned NumOps) {
289  assert(((NumOps << 3) & ~0xffff) == 0 && "Too many inline asm operands!");
290  assert(Kind >= Kind_RegUse && Kind <= Kind_Mem && "Invalid Kind");
291  return Kind | (NumOps << 3);
292  }
293 
294  static bool isRegDefKind(unsigned Flag){ return getKind(Flag) == Kind_RegDef;}
295  static bool isImmKind(unsigned Flag) { return getKind(Flag) == Kind_Imm; }
296  static bool isMemKind(unsigned Flag) { return getKind(Flag) == Kind_Mem; }
297  static bool isRegDefEarlyClobberKind(unsigned Flag) {
299  }
300  static bool isClobberKind(unsigned Flag) {
301  return getKind(Flag) == Kind_Clobber;
302  }
303 
304  /// getFlagWordForMatchingOp - Augment an existing flag word returned by
305  /// getFlagWord with information indicating that this input operand is tied
306  /// to a previous output operand.
307  static unsigned getFlagWordForMatchingOp(unsigned InputFlag,
308  unsigned MatchedOperandNo) {
309  assert(MatchedOperandNo <= 0x7fff && "Too big matched operand");
310  assert((InputFlag & ~0xffff) == 0 && "High bits already contain data");
311  return InputFlag | Flag_MatchingOperand | (MatchedOperandNo << 16);
312  }
313 
314  /// getFlagWordForRegClass - Augment an existing flag word returned by
315  /// getFlagWord with the required register class for the following register
316  /// operands.
317  /// A tied use operand cannot have a register class, use the register class
318  /// from the def operand instead.
319  static unsigned getFlagWordForRegClass(unsigned InputFlag, unsigned RC) {
320  // Store RC + 1, reserve the value 0 to mean 'no register class'.
321  ++RC;
322  assert(!isImmKind(InputFlag) && "Immediates cannot have a register class");
323  assert(!isMemKind(InputFlag) && "Memory operand cannot have a register class");
324  assert(RC <= 0x7fff && "Too large register class ID");
325  assert((InputFlag & ~0xffff) == 0 && "High bits already contain data");
326  return InputFlag | (RC << 16);
327  }
328 
329  /// Augment an existing flag word returned by getFlagWord with the constraint
330  /// code for a memory constraint.
331  static unsigned getFlagWordForMem(unsigned InputFlag, unsigned Constraint) {
332  assert(isMemKind(InputFlag) && "InputFlag is not a memory constraint!");
333  assert(Constraint <= 0x7fff && "Too large a memory constraint ID");
334  assert(Constraint <= Constraints_Max && "Unknown constraint ID");
335  assert((InputFlag & ~0xffff) == 0 && "High bits already contain data");
336  return InputFlag | (Constraint << Constraints_ShiftAmount);
337  }
338 
339  static unsigned convertMemFlagWordToMatchingFlagWord(unsigned InputFlag) {
340  assert(isMemKind(InputFlag));
341  return InputFlag & ~(0x7fff << Constraints_ShiftAmount);
342  }
343 
344  static unsigned getKind(unsigned Flags) {
345  return Flags & 7;
346  }
347 
348  static unsigned getMemoryConstraintID(unsigned Flag) {
350  return (Flag >> Constraints_ShiftAmount) & 0x7fff;
351  }
352 
353  /// getNumOperandRegisters - Extract the number of registers field from the
354  /// inline asm operand flag.
355  static unsigned getNumOperandRegisters(unsigned Flag) {
356  return (Flag & 0xffff) >> 3;
357  }
358 
359  /// isUseOperandTiedToDef - Return true if the flag of the inline asm
360  /// operand indicates it is an use operand that's matched to a def operand.
361  static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx) {
362  if ((Flag & Flag_MatchingOperand) == 0)
363  return false;
364  Idx = (Flag & ~Flag_MatchingOperand) >> 16;
365  return true;
366  }
367 
368  /// hasRegClassConstraint - Returns true if the flag contains a register
369  /// class constraint. Sets RC to the register class ID.
370  static bool hasRegClassConstraint(unsigned Flag, unsigned &RC) {
372  return false;
373  unsigned High = Flag >> 16;
374  // getFlagWordForRegClass() uses 0 to mean no register class, and otherwise
375  // stores RC + 1.
376  if (!High)
377  return false;
378  RC = High - 1;
379  return true;
380  }
381 
382  static std::vector<StringRef> getExtraInfoNames(unsigned ExtraInfo) {
383  std::vector<StringRef> Result;
384  if (ExtraInfo & InlineAsm::Extra_HasSideEffects)
385  Result.push_back("sideeffect");
386  if (ExtraInfo & InlineAsm::Extra_MayLoad)
387  Result.push_back("mayload");
388  if (ExtraInfo & InlineAsm::Extra_MayStore)
389  Result.push_back("maystore");
390  if (ExtraInfo & InlineAsm::Extra_IsConvergent)
391  Result.push_back("isconvergent");
392  if (ExtraInfo & InlineAsm::Extra_IsAlignStack)
393  Result.push_back("alignstack");
394 
395  AsmDialect Dialect =
397 
398  if (Dialect == InlineAsm::AD_ATT)
399  Result.push_back("attdialect");
400  if (Dialect == InlineAsm::AD_Intel)
401  Result.push_back("inteldialect");
402 
403  return Result;
404  }
405 
406  static StringRef getKindName(unsigned Kind) {
407  switch (Kind) {
409  return "reguse";
411  return "regdef";
413  return "regdef-ec";
415  return "clobber";
416  case InlineAsm::Kind_Imm:
417  return "imm";
418  case InlineAsm::Kind_Mem:
419  return "mem";
420  default:
421  llvm_unreachable("Unknown operand kind");
422  }
423  }
424 
425  static StringRef getMemConstraintName(unsigned Constraint) {
426  switch (Constraint) {
428  return "es";
430  return "i";
432  return "m";
434  return "o";
436  return "v";
438  return "Q";
440  return "R";
442  return "S";
444  return "T";
446  return "Um";
448  return "Un";
450  return "Uq";
452  return "Us";
454  return "Ut";
456  return "Uv";
458  return "Uy";
460  return "X";
462  return "Z";
464  return "ZC";
466  return "Zy";
468  return "p";
470  return "ZQ";
472  return "ZR";
474  return "ZS";
476  return "ZT";
477  default:
478  llvm_unreachable("Unknown memory constraint");
479  }
480  }
481 };
482 
483 } // end namespace llvm
484 
485 #endif // LLVM_IR_INLINEASM_H
llvm::InlineAsm::Extra_AsmDialect
@ Extra_AsmDialect
Definition: InlineAsm.h:230
llvm::InlineAsm::ConstraintInfo::MatchingInput
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
Definition: InlineAsm.h:133
llvm::InlineAsm::Kind_Imm
@ Kind_Imm
Definition: InlineAsm.h:242
llvm::InlineAsm::MIOp_ExtraInfo
@ MIOp_ExtraInfo
Definition: InlineAsm.h:224
PointerType
Definition: ItaniumDemangle.h:587
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::InlineAsm::AsmDialect
AsmDialect
Definition: InlineAsm.h:34
llvm::InlineAsm::ConstraintInfo::isCommutative
bool isCommutative
isCommutative - This is set to true for a constraint that is commutative with the next operand.
Definition: InlineAsm.h:141
llvm::lltok::Error
@ Error
Definition: LLToken.h:21
llvm::InlineAsm::Constraint_o
@ Constraint_o
Definition: InlineAsm.h:256
FunctionType
Definition: ItaniumDemangle.h:774
llvm::InlineAsm::ConstraintInfoVector
std::vector< ConstraintInfo > ConstraintInfoVector
Definition: InlineAsm.h:118
llvm::InlineAsm::Constraint_ZC
@ Constraint_ZC
Definition: InlineAsm.h:272
llvm::InlineAsm::getAsmString
const std::string & getAsmString() const
Definition: InlineAsm.h:84
StringRef.h
llvm::InlineAsm::getKindName
static StringRef getKindName(unsigned Kind)
Definition: InlineAsm.h:406
llvm::InlineAsm::isAlignStack
bool isAlignStack() const
Definition: InlineAsm.h:70
llvm::InlineAsm::ConstraintInfo::isIndirect
bool isIndirect
isIndirect - True if this operand is an indirect operand.
Definition: InlineAsm.h:147
llvm::InlineAsm::Op_MDNode
@ Op_MDNode
Definition: InlineAsm.h:218
llvm::InlineAsm::AD_ATT
@ AD_ATT
Definition: InlineAsm.h:35
High
uint64_t High
Definition: NVVMIntrRange.cpp:61
llvm::InlineAsm::convertMemFlagWordToMatchingFlagWord
static unsigned convertMemFlagWordToMatchingFlagWord(unsigned InputFlag)
Definition: InlineAsm.h:339
ErrorHandling.h
llvm::InlineAsm::Constraint_p
@ Constraint_p
Definition: InlineAsm.h:276
llvm::InlineAsm::Constraint_v
@ Constraint_v
Definition: InlineAsm.h:257
llvm::InlineAsm::Op_ExtraInfo
@ Op_ExtraInfo
Definition: InlineAsm.h:219
llvm::InlineAsm::Extra_HasSideEffects
@ Extra_HasSideEffects
Definition: InlineAsm.h:228
llvm::InlineAsm::isUseOperandTiedToDef
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
Definition: InlineAsm.h:361
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::InlineAsm::Constraint_R
@ Constraint_R
Definition: InlineAsm.h:260
llvm::InlineAsm::ConstraintInfo::Parse
bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar)
Parse - Analyze the specified string (e.g.
Definition: InlineAsm.cpp:65
llvm::InlineAsm::Kind_RegDef
@ Kind_RegDef
Definition: InlineAsm.h:239
llvm::InlineAsm::getFunctionType
FunctionType * getFunctionType() const
getFunctionType - InlineAsm's are always pointers to functions.
Definition: InlineAsm.cpp:58
llvm::InlineAsm::MIOp_FirstOperand
@ MIOp_FirstOperand
Definition: InlineAsm.h:225
llvm::InlineAsm::getType
PointerType * getType() const
getType - InlineAsm's are always pointers.
Definition: InlineAsm.h:76
llvm::InlineAsm::Kind_RegDefEarlyClobber
@ Kind_RegDefEarlyClobber
Definition: InlineAsm.h:240
llvm::InlineAsm::Constraints_ShiftAmount
@ Constraints_ShiftAmount
Definition: InlineAsm.h:283
llvm::InlineAsm::Constraint_A
@ Constraint_A
Definition: InlineAsm.h:258
llvm::InlineAsm::classof
static bool classof(const Value *V)
Definition: InlineAsm.h:193
llvm::InlineAsm::Constraint_X
@ Constraint_X
Definition: InlineAsm.h:270
llvm::InlineAsm::ConstraintInfo::currentAlternativeIndex
unsigned currentAlternativeIndex
The currently selected alternative constraint index.
Definition: InlineAsm.h:161
llvm::InlineAsm::Extra_MayStore
@ Extra_MayStore
Definition: InlineAsm.h:232
llvm::InlineAsm::Constraint_Q
@ Constraint_Q
Definition: InlineAsm.h:259
llvm::InlineAsmKeyType
Definition: ConstantsContext.h:380
llvm::InlineAsm::hasSideEffects
bool hasSideEffects() const
Definition: InlineAsm.h:69
llvm::InlineAsm::isInput
@ isInput
Definition: InlineAsm.h:93
llvm::Value::getValueID
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:532
llvm::InlineAsm::Constraint_es
@ Constraint_es
Definition: InlineAsm.h:253
llvm::InlineAsm::isRegDefKind
static bool isRegDefKind(unsigned Flag)
Definition: InlineAsm.h:294
llvm::InlineAsm::Op_InputChain
@ Op_InputChain
Definition: InlineAsm.h:216
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:147
llvm::InlineAsm::Constraint_Um
@ Constraint_Um
Definition: InlineAsm.h:263
llvm::ConstantUniqueMap
Definition: InlineAsm.h:30
llvm::InlineAsm::Flag_MatchingOperand
@ Flag_MatchingOperand
Definition: InlineAsm.h:285
llvm::InlineAsm::getDialect
AsmDialect getDialect() const
Definition: InlineAsm.h:71
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::InlineAsm::get
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)
InlineAsm::get - Return the specified uniqued inline asm string.
Definition: InlineAsm.cpp:43
llvm::InlineAsm::getKind
static unsigned getKind(unsigned Flags)
Definition: InlineAsm.h:344
llvm::InlineAsm::Constraint_ZR
@ Constraint_ZR
Definition: InlineAsm.h:278
llvm::InlineAsm::isMemKind
static bool isMemKind(unsigned Flag)
Definition: InlineAsm.h:296
llvm::InlineAsm::verify
static Error verify(FunctionType *Ty, StringRef Constraints)
This static method can be used by the parser to check to see if the specified constraint string is le...
Definition: InlineAsm.cpp:260
llvm::InlineAsm::Op_AsmString
@ Op_AsmString
Definition: InlineAsm.h:217
llvm::InlineAsm
Definition: InlineAsm.h:32
llvm::InlineAsm::isRegDefEarlyClobberKind
static bool isRegDefEarlyClobberKind(unsigned Flag)
Definition: InlineAsm.h:297
llvm::InlineAsm::canThrow
bool canThrow() const
Definition: InlineAsm.h:72
llvm::InlineAsm::Extra_IsAlignStack
@ Extra_IsAlignStack
Definition: InlineAsm.h:229
index
splat index
Definition: README_ALTIVEC.txt:181
llvm::InlineAsm::Constraint_Uv
@ Constraint_Uv
Definition: InlineAsm.h:268
llvm::InlineAsm::ConstraintInfo::hasArg
bool hasArg() const
Whether this constraint corresponds to an argument.
Definition: InlineAsm.h:176
llvm::InlineAsm::SubConstraintInfo::SubConstraintInfo
SubConstraintInfo()=default
Default constructor.
llvm::InlineAsm::isImmKind
static bool isImmKind(unsigned Flag)
Definition: InlineAsm.h:295
llvm::InlineAsm::Op_FirstOperand
@ Op_FirstOperand
Definition: InlineAsm.h:220
llvm::InlineAsm::ConstraintInfo::isEarlyClobber
bool isEarlyClobber
isEarlyClobber - "&": output operand writes result before inputs are all read.
Definition: InlineAsm.h:127
llvm::InlineAsm::Extra_IsConvergent
@ Extra_IsConvergent
Definition: InlineAsm.h:233
llvm::InlineAsm::Kind_RegUse
@ Kind_RegUse
Definition: InlineAsm.h:238
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:632
llvm::InlineAsm::ConstraintInfo::ConstraintInfo
ConstraintInfo()=default
Default constructor.
llvm::InlineAsm::ConstraintInfo
Definition: InlineAsm.h:120
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::InlineAsm::ConstraintInfo::Codes
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number.
Definition: InlineAsm.h:151
llvm::InlineAsm::Constraint_Uq
@ Constraint_Uq
Definition: InlineAsm.h:265
llvm::InlineAsm::Constraints_Max
@ Constraints_Max
Definition: InlineAsm.h:282
llvm::InlineAsm::getMemoryConstraintID
static unsigned getMemoryConstraintID(unsigned Flag)
Definition: InlineAsm.h:348
llvm::InlineAsm::Constraint_ZT
@ Constraint_ZT
Definition: InlineAsm.h:280
llvm::InlineAsm::SubConstraintInfo::MatchingInput
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
Definition: InlineAsm.h:106
llvm::InlineAsm::getFlagWordForRegClass
static unsigned getFlagWordForRegClass(unsigned InputFlag, unsigned RC)
getFlagWordForRegClass - Augment an existing flag word returned by getFlagWord with the required regi...
Definition: InlineAsm.h:319
llvm::InlineAsm::SubConstraintInfo::Codes
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number.
Definition: InlineAsm.h:110
llvm::InlineAsm::getConstraintString
const std::string & getConstraintString() const
Definition: InlineAsm.h:85
llvm::InlineAsm::AD_Intel
@ AD_Intel
Definition: InlineAsm.h:36
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::InlineAsm::getFlagWord
static unsigned getFlagWord(unsigned Kind, unsigned NumOps)
Definition: InlineAsm.h:288
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
uint32_t
llvm::InlineAsm::isClobberKind
static bool isClobberKind(unsigned Flag)
Definition: InlineAsm.h:300
llvm::InlineAsm::getMemConstraintName
static StringRef getMemConstraintName(unsigned Constraint)
Definition: InlineAsm.h:425
llvm::InlineAsm::getFlagWordForMem
static unsigned getFlagWordForMem(unsigned InputFlag, unsigned Constraint)
Augment an existing flag word returned by getFlagWord with the constraint code for a memory constrain...
Definition: InlineAsm.h:331
llvm::InlineAsm::getFlagWordForMatchingOp
static unsigned getFlagWordForMatchingOp(unsigned InputFlag, unsigned MatchedOperandNo)
getFlagWordForMatchingOp - Augment an existing flag word returned by getFlagWord with information ind...
Definition: InlineAsm.h:307
llvm::InlineAsm::ConstraintInfo::multipleAlternatives
SubConstraintInfoVector multipleAlternatives
multipleAlternatives - If there are multiple alternative constraints, this array will contain them.
Definition: InlineAsm.h:158
llvm::InlineAsm::Constraint_i
@ Constraint_i
Definition: InlineAsm.h:254
llvm::InlineAsm::ConstraintInfo::selectAlternative
void selectAlternative(unsigned index)
selectAlternative - Point this constraint to the alternative constraint indicated by the index.
Definition: InlineAsm.cpp:211
llvm::InlineAsm::Constraint_Un
@ Constraint_Un
Definition: InlineAsm.h:264
llvm::InlineAsm::ConstraintInfo::isMultipleAlternative
bool isMultipleAlternative
isMultipleAlternative - '|': has multiple-alternative constraints.
Definition: InlineAsm.h:154
llvm::InlineAsm::hasRegClassConstraint
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
Definition: InlineAsm.h:370
llvm::InlineAsm::isClobber
@ isClobber
Definition: InlineAsm.h:95
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::InlineAsm::Constraint_Unknown
@ Constraint_Unknown
Definition: InlineAsm.h:252
llvm::InlineAsm::getExtraInfoNames
static std::vector< StringRef > getExtraInfoNames(unsigned ExtraInfo)
Definition: InlineAsm.h:382
llvm::InlineAsm::Constraint_m
@ Constraint_m
Definition: InlineAsm.h:255
llvm::InlineAsm::isOutput
@ isOutput
Definition: InlineAsm.h:94
llvm::InlineAsm::ParseConstraints
ConstraintInfoVector ParseConstraints() const
ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...
Definition: InlineAsm.h:188
llvm::InlineAsm::ConstraintPrefix
ConstraintPrefix
Definition: InlineAsm.h:92
llvm::InlineAsm::getNumOperandRegisters
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag.
Definition: InlineAsm.h:355
llvm::InlineAsm::Constraint_ZS
@ Constraint_ZS
Definition: InlineAsm.h:279
llvm::InlineAsm::operator=
InlineAsm & operator=(const InlineAsm &)=delete
llvm::InlineAsm::ConstraintCodeVector
std::vector< std::string > ConstraintCodeVector
Definition: InlineAsm.h:99
llvm::InlineAsm::Constraint_Us
@ Constraint_Us
Definition: InlineAsm.h:266
llvm::InlineAsm::SubConstraintInfoVector
std::vector< SubConstraintInfo > SubConstraintInfoVector
Definition: InlineAsm.h:116
llvm::InlineAsm::SubConstraintInfo
Definition: InlineAsm.h:101
llvm::InlineAsm::Constraint_Z
@ Constraint_Z
Definition: InlineAsm.h:271
llvm::InlineAsm::MIOp_AsmString
@ MIOp_AsmString
Definition: InlineAsm.h:223
llvm::InlineAsm::Kind_Clobber
@ Kind_Clobber
Definition: InlineAsm.h:241
llvm::InlineAsm::isLabel
@ isLabel
Definition: InlineAsm.h:96
llvm::InlineAsm::Constraint_Uy
@ Constraint_Uy
Definition: InlineAsm.h:269
Value.h
llvm::InlineAsm::Extra_MayLoad
@ Extra_MayLoad
Definition: InlineAsm.h:231
llvm::InlineAsm::Constraint_Zy
@ Constraint_Zy
Definition: InlineAsm.h:273
llvm::InlineAsm::Constraint_ZQ
@ Constraint_ZQ
Definition: InlineAsm.h:277
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::InlineAsm::ConstraintInfo::hasMatchingInput
bool hasMatchingInput() const
hasMatchingInput - Return true if this is an output constraint that has a matching input constraint.
Definition: InlineAsm.h:137
llvm::InlineAsm::Constraint_T
@ Constraint_T
Definition: InlineAsm.h:262
llvm::InlineAsm::Kind_Mem
@ Kind_Mem
Definition: InlineAsm.h:243
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::InlineAsm::Constraint_S
@ Constraint_S
Definition: InlineAsm.h:261
llvm::InlineAsm::Constraint_Ut
@ Constraint_Ut
Definition: InlineAsm.h:267