Go to the documentation of this file.
29 InlineAsm::InlineAsm(
FunctionType *FTy,
const std::string &asmString,
30 const std::string &constraints,
bool hasSideEffects,
31 bool isAlignStack, AsmDialect asmDialect,
bool canThrow)
33 AsmString(asmString), Constraints(constraints), FTy(FTy),
34 HasSideEffects(hasSideEffects), IsAlignStack(isAlignStack),
35 Dialect(asmDialect), CanThrow(
canThrow) {
38 "Function type not legal for constraints!");
42 StringRef Constraints,
bool hasSideEffects,
51 void InlineAsm::destroyConstant() {
66 unsigned multipleAlternativeCount = Str.count(
'|') + 1;
67 unsigned multipleAlternativeIndex = 0;
89 if (
I !=
E && *
I !=
'{')
91 }
else if (*
I ==
'=') {
101 if (
I ==
E)
return true;
104 bool DoneWithModifiers =
false;
105 while (!DoneWithModifiers) {
108 DoneWithModifiers =
true;
127 if (!DoneWithModifiers) {
129 if (
I ==
E)
return true;
138 if (ConstraintEnd ==
E)
return true;
139 pCodes->push_back(std::string(
StringRef(
I, ConstraintEnd + 1 -
I)));
141 }
else if (isdigit(
static_cast<unsigned char>(*
I))) {
144 while (
I !=
E && isdigit(
static_cast<unsigned char>(*
I)))
146 pCodes->push_back(std::string(
StringRef(NumStart,
I - NumStart)));
147 unsigned N = atoi(pCodes->back().c_str());
149 if (
N >= ConstraintsSoFar.size() || ConstraintsSoFar[
N].Type !=
isOutput||
156 if (multipleAlternativeIndex >=
160 ConstraintsSoFar[
N].multipleAlternatives[multipleAlternativeIndex];
169 ConstraintsSoFar.size())
172 ConstraintsSoFar[
N].MatchingInput = ConstraintsSoFar.size();
175 }
else if (*
I ==
'|') {
176 multipleAlternativeIndex++;
179 }
else if (*
I ==
'^') {
182 pCodes->push_back(std::string(
StringRef(
I + 1, 2)));
184 }
else if (*
I ==
'@') {
187 unsigned char C =
static_cast<unsigned char>(*I);
188 assert(isdigit(
C) &&
"Expected a digit!");
190 assert(
N > 0 &&
"Found a zero letter constraint!");
196 pCodes->push_back(std::string(
StringRef(
I, 1)));
207 if (
index < multipleAlternatives.size()) {
208 currentAlternativeIndex =
index;
210 multipleAlternatives[currentAlternativeIndex];
212 Codes = scInfo.
Codes;
222 E = Constraints.
end();
I !=
E; ) {
228 if (ConstraintEnd ==
I ||
234 Result.push_back(
Info);
259 if (Constraints.empty() && !ConstStr.
empty())
return false;
261 unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
262 unsigned NumIndirect = 0;
265 switch (Constraint.Type) {
267 if ((NumInputs-NumIndirect) != 0 || NumClobbers != 0)
269 if (!Constraint.isIndirect) {
276 if (NumClobbers)
return false;
285 switch (NumOutputs) {
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
LLVMContextImpl *const pImpl
ConstantUniqueMap< InlineAsm > InlineAsms
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.
std::vector< ConstraintInfo > ConstraintInfoVector
bool isAlignStack() const
bool isIndirect
isIndirect - True if this operand is an indirect operand.
The instances of the Type class are immutable: once they are created, they are never changed.
bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar)
Parse - Analyze the specified string (e.g.
FunctionType * getFunctionType() const
getFunctionType - InlineAsm's are always pointers to functions.
PointerType * getType() const
getType - InlineAsm's are always pointers.
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
ppc ctr loops PowerPC CTR Loops Verify
unsigned currentAlternativeIndex
The currently selected alternative constraint index.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool hasSideEffects() const
(vector float) vec_cmpeq(*A, *B) C
static bool canThrow(const Value *V)
Analysis containing CSE Info
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.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
bool isEarlyClobber
isEarlyClobber - "&": output operand writes result before inputs are all read.
Class to represent pointers.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number.
bool isVoidTy() const
Return true if this is 'void'.
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.
Class to represent struct types.
StringRef - Represent a constant reference to a string, i.e.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
unsigned getNumElements() const
Random access to the elements.
SubConstraintInfoVector multipleAlternatives
multipleAlternatives - If there are multiple alternative constraints, this array will contain them.
void selectAlternative(unsigned index)
selectAlternative - Point this constraint to the alternative constraint indicated by the index.
bool isMultipleAlternative
isMultipleAlternative - '|': has multiple-alternative constraints.
ConstraintInfoVector ParseConstraints() const
ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...
bool isStructTy() const
True if this is an instance of StructType.
std::vector< std::string > ConstraintCodeVector
Type * getReturnType() const
LLVM Value Representation.
static bool Verify(FunctionType *Ty, StringRef Constraints)
Verify - This static method can be used by the parser to check to see if the specified constraint str...
bool hasMatchingInput() const
hasMatchingInput - Return true if this is an output constraint that has a matching input constraint.
Class to represent function types.