15#ifndef LLVM_IR_INLINEASM_H
16#define LLVM_IR_INLINEASM_H
31template <
class ConstantClass>
class ConstantUniqueMap;
44 std::string AsmString, Constraints;
57 void destroyConstant();
196 return V->getValueID() == Value::InlineAsmVal;
294 assert(((NumOps << 3) & ~0xffff) == 0 &&
"Too many inline asm operands!");
296 return Kind | (NumOps << 3);
314 unsigned MatchedOperandNo) {
315 assert(MatchedOperandNo <= 0x7fff &&
"Too big matched operand");
316 assert((InputFlag & ~0xffff) == 0 &&
"High bits already contain data");
328 assert(!
isImmKind(InputFlag) &&
"Immediates cannot have a register class");
329 assert(!
isMemKind(InputFlag) &&
"Memory operand cannot have a register class");
330 assert(RC <= 0x7fff &&
"Too large register class ID");
331 assert((InputFlag & ~0xffff) == 0 &&
"High bits already contain data");
332 return InputFlag | (RC << 16);
339 "InputFlag is not a memory (include function) constraint!");
340 assert(Constraint <= 0x7fff &&
"Too large a memory constraint ID");
342 assert((InputFlag & ~0xffff) == 0 &&
"High bits already contain data");
357 "Not expected mem or function flang!");
364 return (Flag & 0xffff) >> 3;
372 Idx = (Flag & ~Flag_MatchingOperand) >> 16;
381 unsigned High = Flag >> 16;
391 std::vector<StringRef> Result;
393 Result.push_back(
"sideeffect");
395 Result.push_back(
"mayload");
397 Result.push_back(
"maystore");
399 Result.push_back(
"isconvergent");
401 Result.push_back(
"alignstack");
407 Result.push_back(
"attdialect");
409 Result.push_back(
"inteldialect");
435 switch (Constraint) {
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
Lightweight error class with error context and mandatory checking.
Class to represent function types.
static bool isClobberKind(unsigned Flag)
const std::string & getConstraintString() const
static unsigned getFlagWord(unsigned Kind, unsigned NumOps)
static bool isMemKind(unsigned Flag)
static StringRef getKindName(unsigned Kind)
void collectAsmStrs(SmallVectorImpl< StringRef > &AsmStrs) const
static bool isRegDefKind(unsigned Flag)
const std::string & getAsmString() const
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag.
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.
std::vector< SubConstraintInfo > SubConstraintInfoVector
static unsigned getFlagWordForMem(unsigned InputFlag, unsigned Constraint)
Augment an existing flag word returned by getFlagWord with the constraint code for a memory constrain...
static bool isFuncKind(unsigned Flag)
std::vector< ConstraintInfo > ConstraintInfoVector
static std::vector< StringRef > getExtraInfoNames(unsigned ExtraInfo)
bool isAlignStack() const
static StringRef getMemConstraintName(unsigned Constraint)
AsmDialect getDialect() const
static unsigned getMemoryConstraintID(unsigned Flag)
@ Kind_RegDefEarlyClobber
@ Constraints_ShiftAmount
FunctionType * getFunctionType() const
getFunctionType - InlineAsm's are always pointers to functions.
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
bool hasSideEffects() const
InlineAsm(const InlineAsm &)=delete
static bool isImmKind(unsigned Flag)
ConstraintInfoVector ParseConstraints() const
ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...
static bool isRegDefEarlyClobberKind(unsigned Flag)
std::vector< std::string > ConstraintCodeVector
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
static unsigned getFlagWordForMatchingOp(unsigned InputFlag, unsigned MatchedOperandNo)
getFlagWordForMatchingOp - Augment an existing flag word returned by getFlagWord with information ind...
static unsigned getKind(unsigned Flags)
static unsigned convertMemFlagWordToMatchingFlagWord(unsigned InputFlag)
static unsigned getFlagWordForRegClass(unsigned InputFlag, unsigned RC)
getFlagWordForRegClass - Augment an existing flag word returned by getFlagWord with the required regi...
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...
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
#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.
bool isCommutative
isCommutative - This is set to true for a constraint that is commutative with the next operand.
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.
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.
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.