mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
The personality function should be a Function* and not just a Value*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136392 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6bd4842f89
commit
7379b66500
@ -1806,16 +1806,16 @@ private:
|
||||
return User::operator new(s, 0);
|
||||
}
|
||||
void growOperands();
|
||||
void init(Value *PersFn, unsigned NumReservedValues, const Twine &NameStr);
|
||||
void init(Function *PersFn, unsigned NumReservedValues, const Twine &NameStr);
|
||||
|
||||
explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
|
||||
explicit LandingPadInst(Type *RetTy, Function *PersonalityFn,
|
||||
unsigned NumReservedValues, const Twine &NameStr,
|
||||
Instruction *InsertBefore)
|
||||
: Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertBefore),
|
||||
IsCleanup(false) {
|
||||
init(PersonalityFn, 1 + NumReservedValues, NameStr);
|
||||
}
|
||||
explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
|
||||
explicit LandingPadInst(Type *RetTy, Function *PersonalityFn,
|
||||
unsigned NumReservedValues, const Twine &NameStr,
|
||||
BasicBlock *InsertAtEnd)
|
||||
: Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertAtEnd),
|
||||
@ -1825,14 +1825,14 @@ private:
|
||||
protected:
|
||||
virtual LandingPadInst *clone_impl() const;
|
||||
public:
|
||||
static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
|
||||
static LandingPadInst *Create(Type *RetTy, Function *PersonalityFn,
|
||||
unsigned NumReservedValues,
|
||||
const Twine &NameStr = "",
|
||||
Instruction *InsertBefore = 0) {
|
||||
return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
|
||||
InsertBefore);
|
||||
}
|
||||
static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
|
||||
static LandingPadInst *Create(Type *RetTy, Function *PersonalityFn,
|
||||
unsigned NumReservedValues,
|
||||
const Twine &NameStr, BasicBlock *InsertAtEnd) {
|
||||
return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
|
||||
@ -1845,7 +1845,9 @@ public:
|
||||
|
||||
/// getPersonalityFn - Get the personality function associated with this
|
||||
/// landing pad.
|
||||
const Value *getPersonalityFn() const { return getOperand(0); }
|
||||
const Function *getPersonalityFn() const {
|
||||
return cast<Function>(getOperand(0));
|
||||
}
|
||||
|
||||
// Simple accessors.
|
||||
bool isCleanup() const { return IsCleanup; }
|
||||
|
@ -1198,7 +1198,7 @@ public:
|
||||
return Insert(InsertValueInst::Create(Agg, Val, Idxs), Name);
|
||||
}
|
||||
|
||||
Value *CreateLandingPad(Type *Ty, Value *PersFn, unsigned NumClauses,
|
||||
Value *CreateLandingPad(Type *Ty, Function *PersFn, unsigned NumClauses,
|
||||
const Twine &Name = "") {
|
||||
return Insert(LandingPadInst::Create(Ty, PersFn, NumClauses, Name));
|
||||
}
|
||||
|
@ -3547,7 +3547,8 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
} while (EatIfPresent(lltok::comma));
|
||||
}
|
||||
|
||||
LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, Clauses.size());
|
||||
LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
|
||||
Clauses.size());
|
||||
LP->setCleanup(IsCleanup);
|
||||
|
||||
for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType,
|
||||
|
@ -2539,7 +2539,8 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
|
||||
bool IsCleanup = !!Record[Idx++];
|
||||
unsigned NumClauses = Record[Idx++];
|
||||
LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, NumClauses);
|
||||
LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
|
||||
NumClauses);
|
||||
LP->setCleanup(IsCleanup);
|
||||
for (unsigned J = 0; J != NumClauses; ++J) {
|
||||
LandingPadInst::ClauseType CT =
|
||||
|
@ -914,10 +914,6 @@ void SelectionDAGBuilder::visitPHI(const PHINode &) {
|
||||
llvm_unreachable("SelectionDAGBuilder shouldn't visit PHI nodes!");
|
||||
}
|
||||
|
||||
void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &) {
|
||||
// FIXME: Handle this
|
||||
}
|
||||
|
||||
void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) {
|
||||
// Note: this doesn't use InstVisitor, because it has to work with
|
||||
// ConstantExpr's in addition to instructions.
|
||||
@ -1813,7 +1809,13 @@ void SelectionDAGBuilder::visitUnwind(const UnwindInst &I) {
|
||||
}
|
||||
|
||||
void SelectionDAGBuilder::visitResume(const ResumeInst &RI) {
|
||||
llvm_unreachable("SelectionDAGBuilder shouldn't visit resume instructions!");
|
||||
}
|
||||
|
||||
void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &) {
|
||||
// FIXME: Handle this
|
||||
assert(FuncInfo.MBB->isLandingPad() &&
|
||||
"Call to landingpad not in landing pad!");
|
||||
}
|
||||
|
||||
/// handleSmallSwitchCaseRange - Emit a series of specific tests (suitable for
|
||||
|
@ -1686,7 +1686,8 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
|
||||
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef PersFn, unsigned NumClauses,
|
||||
const char *Name) {
|
||||
return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), unwrap(PersFn),
|
||||
return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty),
|
||||
cast<Function>(unwrap(PersFn)),
|
||||
NumClauses, Name));
|
||||
}
|
||||
|
||||
|
@ -170,12 +170,12 @@ Value *PHINode::hasConstantValue() const {
|
||||
// LandingPadInst Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void LandingPadInst::init(Value *PersFn, unsigned NumReservedValues,
|
||||
void LandingPadInst::init(Function *PersFn, unsigned NumReservedValues,
|
||||
const Twine &NameStr) {
|
||||
ReservedSpace = NumReservedValues;
|
||||
NumOperands = 1;
|
||||
OperandList = allocHungoffUses(ReservedSpace);
|
||||
OperandList[0] = PersFn;
|
||||
OperandList[0] = (Value*)PersFn;
|
||||
setName(NameStr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user