forked from OSchip/llvm-project
[IR] Add ConstraintInfo::hasArg() helper (NFC)
Checking whether a constraint corresponds to an argument is a recurring pattern.
This commit is contained in:
parent
c033f0d9b1
commit
e4d1779990
llvm
include/llvm/IR
lib
Bitcode/Reader
CodeGen
IR
|
@ -171,6 +171,11 @@ public:
|
|||
/// selectAlternative - Point this constraint to the alternative constraint
|
||||
/// indicated by the index.
|
||||
void selectAlternative(unsigned index);
|
||||
|
||||
/// Whether this constraint corresponds to an argument.
|
||||
bool hasArg() const {
|
||||
return Type == isInput || (Type == isOutput && isIndirect);
|
||||
}
|
||||
};
|
||||
|
||||
/// ParseConstraints - Split up the constraint string into the specific
|
||||
|
|
|
@ -3927,9 +3927,7 @@ void BitcodeReader::propagateAttributeTypes(CallBase *CB,
|
|||
const InlineAsm *IA = cast<InlineAsm>(CB->getCalledOperand());
|
||||
unsigned ArgNo = 0;
|
||||
for (const InlineAsm::ConstraintInfo &CI : IA->ParseConstraints()) {
|
||||
bool HasArg = CI.Type == InlineAsm::isInput ||
|
||||
(CI.Type == InlineAsm::isOutput && CI.isIndirect);
|
||||
if (!HasArg)
|
||||
if (!CI.hasArg())
|
||||
continue;
|
||||
|
||||
if (CI.isIndirect && !CB->getAttributes().getParamElementType(ArgNo)) {
|
||||
|
|
|
@ -297,9 +297,7 @@ bool InlineAsmLowering::lowerInlineAsm(
|
|||
GISelAsmOperandInfo &OpInfo = ConstraintOperands.back();
|
||||
|
||||
// Compute the value type for each operand.
|
||||
if (OpInfo.Type == InlineAsm::isInput ||
|
||||
(OpInfo.Type == InlineAsm::isOutput && OpInfo.isIndirect)) {
|
||||
|
||||
if (OpInfo.hasArg()) {
|
||||
OpInfo.CallOperandVal = const_cast<Value *>(Call.getArgOperand(ArgNo++));
|
||||
|
||||
if (isa<BasicBlock>(OpInfo.CallOperandVal)) {
|
||||
|
|
|
@ -8565,8 +8565,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
|
|||
SDISelAsmOperandInfo &OpInfo = ConstraintOperands.back();
|
||||
|
||||
// Compute the value type for each operand.
|
||||
if (OpInfo.Type == InlineAsm::isInput ||
|
||||
(OpInfo.Type == InlineAsm::isOutput && OpInfo.isIndirect)) {
|
||||
if (OpInfo.hasArg()) {
|
||||
OpInfo.CallOperandVal = Call.getArgOperand(ArgNo++);
|
||||
|
||||
// Process the call argument. BasicBlocks are labels, currently appearing
|
||||
|
|
|
@ -2151,9 +2151,7 @@ void Verifier::verifyInlineAsmCall(const CallBase &Call) {
|
|||
unsigned ArgNo = 0;
|
||||
for (const InlineAsm::ConstraintInfo &CI : IA->ParseConstraints()) {
|
||||
// Only deal with constraints that correspond to call arguments.
|
||||
bool HasArg = CI.Type == InlineAsm::isInput ||
|
||||
(CI.Type == InlineAsm::isOutput && CI.isIndirect);
|
||||
if (!HasArg)
|
||||
if (!CI.hasArg())
|
||||
continue;
|
||||
|
||||
if (CI.isIndirect) {
|
||||
|
|
Loading…
Reference in New Issue