[PATCH] D57415: [IR] Use CallBase to simplify some code
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 29 19:45:18 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352600: [IR] Use CallBase to simplify some code (authored by ctopper, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57415?vs=184167&id=184243#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57415/new/
https://reviews.llvm.org/D57415
Files:
llvm/trunk/include/llvm/IR/CallSite.h
llvm/trunk/include/llvm/IR/InstrTypes.h
llvm/trunk/include/llvm/IR/Instructions.h
Index: llvm/trunk/include/llvm/IR/CallSite.h
===================================================================
--- llvm/trunk/include/llvm/IR/CallSite.h
+++ llvm/trunk/include/llvm/IR/CallSite.h
@@ -243,11 +243,11 @@
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 @@
#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.
Index: llvm/trunk/include/llvm/IR/InstrTypes.h
===================================================================
--- llvm/trunk/include/llvm/IR/InstrTypes.h
+++ llvm/trunk/include/llvm/IR/InstrTypes.h
@@ -1232,6 +1232,9 @@
(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
Index: llvm/trunk/include/llvm/IR/Instructions.h
===================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h
+++ llvm/trunk/include/llvm/IR/Instructions.h
@@ -1703,9 +1703,6 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57415.184243.patch
Type: text/x-patch
Size: 2500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190130/7f2dbd16/attachment.bin>
More information about the llvm-commits
mailing list