31 InlineAsm::InlineAsm(
FunctionType *FTy,
const std::string &asmString,
32 const std::string &constraints,
bool hasSideEffects,
33 bool isAlignStack, AsmDialect asmDialect)
35 AsmString(asmString), Constraints(constraints), FTy(FTy),
36 HasSideEffects(hasSideEffects), IsAlignStack(isAlignStack),
40 "Function type not legal for constraints!");
44 StringRef Constraints,
bool hasSideEffects,
47 isAlignStack, asmDialect);
52 void InlineAsm::destroyConstant() {
67 unsigned multipleAlternativeCount = Str.
count(
'|') + 1;
68 unsigned multipleAlternativeIndex = 0;
90 if (I !=
E && *I !=
'{')
92 }
else if (*I ==
'=') {
102 if (I ==
E)
return true;
105 bool DoneWithModifiers =
false;
106 while (!DoneWithModifiers) {
109 DoneWithModifiers =
true;
128 if (!DoneWithModifiers) {
130 if (I ==
E)
return true;
139 if (ConstraintEnd ==
E)
return true;
140 pCodes->push_back(
StringRef(I, ConstraintEnd+1 - I));
142 }
else if (isdigit(static_cast<unsigned char>(*I))) {
145 while (I !=
E && isdigit(static_cast<unsigned char>(*I)))
147 pCodes->push_back(
StringRef(NumStart, I - NumStart));
148 unsigned N = atoi(pCodes->back().c_str());
150 if (N >= ConstraintsSoFar.size() || ConstraintsSoFar[
N].Type !=
isOutput||
157 if (multipleAlternativeIndex >=
161 ConstraintsSoFar[
N].multipleAlternatives[multipleAlternativeIndex];
169 ConstraintsSoFar.size())
172 ConstraintsSoFar[
N].MatchingInput = ConstraintsSoFar.size();
174 }
else if (*I ==
'|') {
175 multipleAlternativeIndex++;
178 }
else if (*I ==
'^') {
196 if (index < multipleAlternatives.size()) {
197 currentAlternativeIndex = index;
199 multipleAlternatives[currentAlternativeIndex];
201 Codes = scInfo.
Codes;
211 E = Constraints.
end();
I !=
E; ) {
217 if (ConstraintEnd ==
I ||
223 Result.push_back(Info);
248 if (Constraints.empty() && !ConstStr.
empty())
return false;
250 unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
251 unsigned NumIndirect = 0;
253 for (
unsigned i = 0, e = Constraints.size(); i != e; ++i) {
254 switch (Constraints[i].
Type) {
256 if ((NumInputs-NumIndirect) != 0 || NumClobbers != 0)
258 if (!Constraints[i].isIndirect) {
265 if (NumClobbers)
return false;
274 switch (NumOutputs) {
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar)
Parse - Analyze the specified string (e.g.
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number...
std::vector< std::string > ConstraintCodeVector
bool isCommutative
isCommutative - This is set to true for a constraint that is commutative with the next operand...
Class to represent struct types.
ConstraintInfoVector ParseConstraints() const
ParseConstraints - Parse the constraints of this inlineasm object, returning them the same way that P...
ConstantUniqueMap< InlineAsm > InlineAsms
Class to represent function types.
ppc ctr loops PowerPC CTR Loops Verify
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
signed char MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
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...
Class to represent pointers.
bool isEarlyClobber
isEarlyClobber - "&": output operand writes result before inputs are all read.
The instances of the Type class are immutable: once they are created, they are never changed...
unsigned currentAlternativeIndex
The currently selected alternative constraint index.
bool isIndirect
isIndirect - True if this operand is an indirect operand.
SubConstraintInfoVector multipleAlternatives
multipleAlternatives - If there are multiple alternative constraints, this array will contain them...
PointerType * getType() const
getType - InlineAsm's are always pointers.
LLVM_NODISCARD size_t count(char C) const
Return the number of occurrences of C in the string.
LLVMContextImpl *const pImpl
std::vector< ConstraintInfo > ConstraintInfoVector
signed char MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
FunctionType * getFunctionType() const
getFunctionType - InlineAsm's are always pointers to functions.
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number...
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
bool hasMatchingInput() const
hasMatchingInput - Return true if this is an output constraint that has a matching input constraint...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
bool isStructTy() const
True if this is an instance of StructType.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT)
InlineAsm::get - Return the specified uniqued inline asm string.
Type * getReturnType() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
unsigned getNumElements() const
Random access to the elements.
bool isMultipleAlternative
isMultipleAlternative - '|': has multiple-alternative constraints.
bool isVoidTy() const
Return true if this is 'void'.
void selectAlternative(unsigned index)
selectAlternative - Point this constraint to the alternative constraint indicated by the index...