15#ifndef LLVM_IR_INLINEASM_H
16#define LLVM_IR_INLINEASM_H
36class InlineAsm final :
public Value {
47 std::string AsmString, Constraints;
54 InlineAsm(
FunctionType *Ty,
const std::string &AsmString,
60 void destroyConstant();
201 return V->getValueID() == Value::InlineAsmVal;
378 "Too many operands for a flag");
387 Idx = getMatchedOperandNo();
400 RC = getRegClass() - 1;
406 "Not expected mem or function flag!");
413 assert(getMatchedOperandNo() == 0 &&
"Matching operand already set");
424 assert(getRegClass() == 0 &&
"Register class already set");
439 "Flag is not a memory or function constraint!");
458 assert(!isMatched() &&
"Tied operand cannot be marked foldable");
476 std::vector<StringRef> Result;
478 Result.push_back(
"sideeffect");
480 Result.push_back(
"mayload");
482 Result.push_back(
"maystore");
484 Result.push_back(
"isconvergent");
486 Result.push_back(
"alignstack");
488 Result.push_back(
"unwind");
492 Result.push_back(
"attdialect");
494 Result.push_back(
"inteldialect");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements methods to test, set and extract typed bits from packed unsigned integers.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file defines the SmallVector class.
Lightweight error class with error context and mandatory checking.
Class to represent function types.
void setRegMayBeFolded(bool B)
Set a bit to denote that while this operand is some kind of register (use, def, .....
bool isClobberKind() const
void setRegClass(unsigned RC)
setRegClass - Augment an existing flag with the required register class for the following register op...
void setNumOperandRegisters(unsigned NumOps)
Set the number of operands that follow the flag.
StringRef getKindName() const
void clearMemConstraint()
clearMemConstraint - Similar to setMemConstraint(0), but without the assertion checking that the cons...
Flag(enum Kind K, unsigned NumOps)
bool hasRegClassConstraint(unsigned &RC) const
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
bool isRegUseKind() const
void setMatchingOp(unsigned OperandNo)
setMatchingOp - Augment an existing flag with information indicating that this input operand is tied ...
void setMemConstraint(ConstraintCode C)
setMemConstraint - Augment an existing flag with the constraint code for a memory constraint.
ConstraintCode getMemoryConstraintID() const
static constexpr unsigned getMaxNumOperandRegisters()
The largest number of operands that a flag can describe.
bool getRegMayBeFolded() const
bool isUseOperandTiedToDef(unsigned &Idx) const
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
unsigned getNumOperandRegisters() const
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag.
bool isRegDefEarlyClobberKind() const
bool isRegDefKind() const
LLVM_ABI void collectAsmStrs(SmallVectorImpl< StringRef > &AsmStrs) const
static AsmDialect getDialect(unsigned ExtraInfo)
static LLVM_ABI 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.
std::vector< SubConstraintInfo > SubConstraintInfoVector
std::vector< ConstraintInfo > ConstraintInfoVector
static std::vector< StringRef > getExtraInfoNames(unsigned ExtraInfo)
friend struct InlineAsmKeyType
bool isAlignStack() const
AsmDialect getDialect() const
LLVM_ABI FunctionType * getFunctionType() const
getFunctionType - InlineAsm's are always pointers to functions.
bool hasSideEffects() const
StringRef getAsmString() const
InlineAsm(const InlineAsm &)=delete
ConstraintInfoVector ParseConstraints() const
ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...
std::vector< std::string > ConstraintCodeVector
static StringRef getMemConstraintName(ConstraintCode C)
StringRef getConstraintString() const
PointerType * getType() const
getType - InlineAsm's are always pointers.
static bool classof(const Value *V)
InlineAsm & operator=(const InlineAsm &)=delete
Class to represent pointers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI Value(Type *Ty, unsigned scid)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
Describes an element of a Bitfield.
static constexpr unsigned Bits
static Bitfield::Type get(StorageType Packed)
Unpacks the field from the Packed value.
static void set(StorageType &Packed, typename Bitfield::Type Value)
Sets the typed value in the provided Packed value.
bool isCommutative
isCommutative - This is set to true for a constraint that is commutative with the next operand.
ConstraintPrefix Type
Type - The basic type of the constraint: input/output/clobber/label.
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number.
unsigned currentAlternativeIndex
The currently selected alternative constraint index.
ConstraintInfo()=default
Default constructor.
LLVM_ABI bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar)
Parse - Analyze the specified string (e.g.
bool hasArg() const
Whether this constraint corresponds to an argument.
SubConstraintInfoVector multipleAlternatives
multipleAlternatives - If there are multiple alternative constraints, this array will contain them.
bool isIndirect
isIndirect - True if this operand is an indirect operand.
bool isEarlyClobber
isEarlyClobber - "&": output operand writes result before inputs are all read.
bool isMultipleAlternative
isMultipleAlternative - '|': has multiple-alternative constraints.
LLVM_ABI void selectAlternative(unsigned index)
selectAlternative - Point this constraint to the alternative constraint indicated by the index.
bool hasMatchingInput() const
hasMatchingInput - Return true if this is an output constraint that has a matching input constraint.
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number.
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
SubConstraintInfo()=default
Default constructor.