mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 20:29:30 +00:00
[opaque pointer type] Pass the explicit function type down to the instruction constructor when parsing invoke instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2727b58c88
commit
115494b777
@ -3090,15 +3090,30 @@ class InvokeInst : public TerminatorInst {
|
|||||||
FunctionType *FTy;
|
FunctionType *FTy;
|
||||||
InvokeInst(const InvokeInst &BI);
|
InvokeInst(const InvokeInst &BI);
|
||||||
void init(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
|
void init(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
ArrayRef<Value *> Args, const Twine &NameStr);
|
ArrayRef<Value *> Args, const Twine &NameStr) {
|
||||||
|
init(cast<FunctionType>(
|
||||||
|
cast<PointerType>(Func->getType())->getElementType()),
|
||||||
|
Func, IfNormal, IfException, Args, NameStr);
|
||||||
|
}
|
||||||
|
void init(FunctionType *FTy, Value *Func, BasicBlock *IfNormal,
|
||||||
|
BasicBlock *IfException, ArrayRef<Value *> Args,
|
||||||
|
const Twine &NameStr);
|
||||||
|
|
||||||
/// Construct an InvokeInst given a range of arguments.
|
/// Construct an InvokeInst given a range of arguments.
|
||||||
///
|
///
|
||||||
/// \brief Construct an InvokeInst from a range of arguments
|
/// \brief Construct an InvokeInst from a range of arguments
|
||||||
inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
|
inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
ArrayRef<Value *> Args, unsigned Values,
|
ArrayRef<Value *> Args, unsigned Values,
|
||||||
const Twine &NameStr, Instruction *InsertBefore);
|
const Twine &NameStr, Instruction *InsertBefore)
|
||||||
|
: InvokeInst(cast<FunctionType>(
|
||||||
|
cast<PointerType>(Func->getType())->getElementType()),
|
||||||
|
Func, IfNormal, IfException, Args, Values, NameStr,
|
||||||
|
InsertBefore) {}
|
||||||
|
|
||||||
|
inline InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
|
||||||
|
BasicBlock *IfException, ArrayRef<Value *> Args,
|
||||||
|
unsigned Values, const Twine &NameStr,
|
||||||
|
Instruction *InsertBefore);
|
||||||
/// Construct an InvokeInst given a range of arguments.
|
/// Construct an InvokeInst given a range of arguments.
|
||||||
///
|
///
|
||||||
/// \brief Construct an InvokeInst from a range of arguments
|
/// \brief Construct an InvokeInst from a range of arguments
|
||||||
@ -3112,8 +3127,16 @@ public:
|
|||||||
BasicBlock *IfNormal, BasicBlock *IfException,
|
BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
ArrayRef<Value *> Args, const Twine &NameStr = "",
|
ArrayRef<Value *> Args, const Twine &NameStr = "",
|
||||||
Instruction *InsertBefore = nullptr) {
|
Instruction *InsertBefore = nullptr) {
|
||||||
|
return Create(cast<FunctionType>(
|
||||||
|
cast<PointerType>(Func->getType())->getElementType()),
|
||||||
|
Func, IfNormal, IfException, Args, NameStr, InsertBefore);
|
||||||
|
}
|
||||||
|
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
|
||||||
|
BasicBlock *IfException, ArrayRef<Value *> Args,
|
||||||
|
const Twine &NameStr = "",
|
||||||
|
Instruction *InsertBefore = nullptr) {
|
||||||
unsigned Values = unsigned(Args.size()) + 3;
|
unsigned Values = unsigned(Args.size()) + 3;
|
||||||
return new(Values) InvokeInst(Func, IfNormal, IfException, Args,
|
return new (Values) InvokeInst(Ty, Func, IfNormal, IfException, Args,
|
||||||
Values, NameStr, InsertBefore);
|
Values, NameStr, InsertBefore);
|
||||||
}
|
}
|
||||||
static InvokeInst *Create(Value *Func,
|
static InvokeInst *Create(Value *Func,
|
||||||
@ -3357,16 +3380,14 @@ template <>
|
|||||||
struct OperandTraits<InvokeInst> : public VariadicOperandTraits<InvokeInst, 3> {
|
struct OperandTraits<InvokeInst> : public VariadicOperandTraits<InvokeInst, 3> {
|
||||||
};
|
};
|
||||||
|
|
||||||
InvokeInst::InvokeInst(Value *Func,
|
InvokeInst::InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
|
||||||
BasicBlock *IfNormal, BasicBlock *IfException,
|
BasicBlock *IfException, ArrayRef<Value *> Args,
|
||||||
ArrayRef<Value *> Args, unsigned Values,
|
unsigned Values, const Twine &NameStr,
|
||||||
const Twine &NameStr, Instruction *InsertBefore)
|
Instruction *InsertBefore)
|
||||||
: TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
|
: TerminatorInst(Ty->getReturnType(), Instruction::Invoke,
|
||||||
->getElementType())->getReturnType(),
|
OperandTraits<InvokeInst>::op_end(this) - Values, Values,
|
||||||
Instruction::Invoke,
|
InsertBefore) {
|
||||||
OperandTraits<InvokeInst>::op_end(this) - Values,
|
init(Ty, Func, IfNormal, IfException, Args, NameStr);
|
||||||
Values, InsertBefore) {
|
|
||||||
init(Func, IfNormal, IfException, Args, NameStr);
|
|
||||||
}
|
}
|
||||||
InvokeInst::InvokeInst(Value *Func,
|
InvokeInst::InvokeInst(Value *Func,
|
||||||
BasicBlock *IfNormal, BasicBlock *IfException,
|
BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
|
@ -4826,7 +4826,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
// Finish off the Attribute and check them
|
// Finish off the Attribute and check them
|
||||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||||
|
|
||||||
InvokeInst *II = InvokeInst::Create(Callee, NormalBB, UnwindBB, Args);
|
InvokeInst *II = InvokeInst::Create(Ty, Callee, NormalBB, UnwindBB, Args);
|
||||||
II->setCallingConv(CC);
|
II->setCallingConv(CC);
|
||||||
II->setAttributes(PAL);
|
II->setAttributes(PAL);
|
||||||
ForwardRefAttrGroups[II] = FwdRefAttrGrps;
|
ForwardRefAttrGroups[II] = FwdRefAttrGrps;
|
||||||
|
@ -537,9 +537,10 @@ Instruction* CallInst::CreateFree(Value* Source, BasicBlock *InsertAtEnd) {
|
|||||||
// InvokeInst Implementation
|
// InvokeInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
void InvokeInst::init(FunctionType *FTy, Value *Fn, BasicBlock *IfNormal,
|
||||||
ArrayRef<Value *> Args, const Twine &NameStr) {
|
BasicBlock *IfException, ArrayRef<Value *> Args,
|
||||||
FTy = cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
|
const Twine &NameStr) {
|
||||||
|
this->FTy = FTy;
|
||||||
|
|
||||||
assert(NumOperands == 3 + Args.size() && "NumOperands not set up?");
|
assert(NumOperands == 3 + Args.size() && "NumOperands not set up?");
|
||||||
Op<-3>() = Fn;
|
Op<-3>() = Fn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user