mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 08:18:33 +00:00
[Verifier] Verify invokes of intrinsics
We support invoking a subset of llvm's intrinsics, but the verifier didn't account for this. We had previously added a special case to verify invokes of statepoints. By generalizing the code in terms of CallSite, we can verify invokes of other intrinsics as well. Interestingly, this found one test case which was invalid. Note: I'm deliberately leaving the naming change from CI to CS to a follow up change. That will happen shortly, I just wanted to reduce the diff to make it clear what was happening with this one. Differential Revision: http://reviews.llvm.org/D10118 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,6 +38,7 @@ class CallInst;
|
||||
class InvokeInst;
|
||||
|
||||
template <typename FunTy = const Function,
|
||||
typename BBTy = const BasicBlock,
|
||||
typename ValTy = const Value,
|
||||
typename UserTy = const User,
|
||||
typename InstrTy = const Instruction,
|
||||
@@ -82,6 +83,9 @@ public:
|
||||
InstrTy *operator->() const { return I.getPointer(); }
|
||||
explicit operator bool() const { return I.getPointer(); }
|
||||
|
||||
/// Get the basic block containing the call site
|
||||
BBTy* getParent() const { return getInstruction()->getParent(); }
|
||||
|
||||
/// getCalledValue - Return the pointer to function that is being called.
|
||||
///
|
||||
ValTy *getCalledValue() const {
|
||||
@@ -189,6 +193,20 @@ public:
|
||||
else \
|
||||
cast<InvokeInst>(II)->METHOD
|
||||
|
||||
unsigned getNumArgOperands() const {
|
||||
CALLSITE_DELEGATE_GETTER(getNumArgOperands());
|
||||
}
|
||||
|
||||
Value *getArgOperand(unsigned i) const {
|
||||
CALLSITE_DELEGATE_GETTER(getArgOperand(i));
|
||||
}
|
||||
|
||||
bool isInlineAsm() const {
|
||||
if (isCall())
|
||||
return cast<CallInst>(getInstruction())->isInlineAsm();
|
||||
return false;
|
||||
}
|
||||
|
||||
/// getCallingConv/setCallingConv - get or set the calling convention of the
|
||||
/// call.
|
||||
CallingConv::ID getCallingConv() const {
|
||||
@@ -366,8 +384,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class CallSite : public CallSiteBase<Function, Value, User, Instruction,
|
||||
CallInst, InvokeInst, User::op_iterator> {
|
||||
class CallSite : public CallSiteBase<Function, BasicBlock, Value, User,
|
||||
Instruction, CallInst, InvokeInst,
|
||||
User::op_iterator> {
|
||||
public:
|
||||
CallSite() {}
|
||||
CallSite(CallSiteBase B) : CallSiteBase(B) {}
|
||||
|
||||
Reference in New Issue
Block a user