summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-01-30 03:43:41 +0000
committerCraig Topper <craig.topper@intel.com>2019-01-30 03:43:41 +0000
commita8710a6e7ea8bca33f25b0af796c34cf88bde066 (patch)
tree68f5d4f412609cef516d8b759a54f6e74b39c362 /llvm
parentf6cab162583c98838807cf020e3fbc99514c3c38 (diff)
downloadbcm5719-llvm-a8710a6e7ea8bca33f25b0af796c34cf88bde066.tar.gz
bcm5719-llvm-a8710a6e7ea8bca33f25b0af796c34cf88bde066.zip
[IR] Use CallBase to simplify some code
Summary: This patch does the following to simplify the asm-goto patch -Move isInlineAsm from CallInst to CallBase to share with CallBrInst in the asm-goto patch. -Forward CallSite's data_operands_begin()/data_operands_end() to CallBase's implementation. -Forward CallSite's getOperandBundlesAsDefs to CallBase. Reviewers: chandlerc Reviewed By: chandlerc Subscribers: nickdesaulniers, llvm-commits Differential Revision: https://reviews.llvm.org/D57415 llvm-svn: 352600
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/CallSite.h10
-rw-r--r--llvm/include/llvm/IR/InstrTypes.h3
-rw-r--r--llvm/include/llvm/IR/Instructions.h3
3 files changed, 6 insertions, 10 deletions
diff --git a/llvm/include/llvm/IR/CallSite.h b/llvm/include/llvm/IR/CallSite.h
index fba4b25d16d..d11b6b01b1f 100644
--- a/llvm/include/llvm/IR/CallSite.h
+++ b/llvm/include/llvm/IR/CallSite.h
@@ -243,11 +243,11 @@ public:
IterTy data_operands_begin() const {
assert(getInstruction() && "Not a call or invoke instruction!");
- return (*this)->op_begin();
+ return cast<CallBase>(getInstruction())->data_operands_begin();
}
IterTy data_operands_end() const {
assert(getInstruction() && "Not a call or invoke instruction!");
- return (*this)->op_end() - (isCall() ? 1 : 3);
+ return cast<CallBase>(getInstruction())->data_operands_end();
}
iterator_range<IterTy> data_ops() const {
return make_range(data_operands_begin(), data_operands_end());
@@ -579,13 +579,9 @@ public:
#undef CALLSITE_DELEGATE_SETTER
void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const {
- const Instruction *II = getInstruction();
// Since this is actually a getter that "looks like" a setter, don't use the
// above macros to avoid confusion.
- if (isCall())
- cast<CallInst>(II)->getOperandBundlesAsDefs(Defs);
- else
- cast<InvokeInst>(II)->getOperandBundlesAsDefs(Defs);
+ cast<CallBase>(getInstruction())->getOperandBundlesAsDefs(Defs);
}
/// Determine whether this data operand is not captured.
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 07968ee6081..f0d52fdecdb 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1232,6 +1232,9 @@ public:
(ID << 2));
}
+ /// Check if this call is an inline asm statement.
+ bool isInlineAsm() const { return isa<InlineAsm>(getCalledOperand()); }
+
/// \name Attribute API
///
/// These methods access and modify attributes on this call (including
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index beadf7313a2..dfd11c5e97b 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1703,9 +1703,6 @@ public:
addAttribute(AttributeList::FunctionIndex, Attribute::ReturnsTwice);
}
- /// Check if this call is an inline asm statement.
- bool isInlineAsm() const { return isa<InlineAsm>(getCalledOperand()); }
-
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Call;
OpenPOWER on IntegriCloud