mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
Make sure that the landingpad instruction takes a Constant* as the clause's value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f66c45f35
commit
28d735230f
@ -1852,7 +1852,7 @@ public:
|
|||||||
void setCleanup(bool Val) { IsCleanup = Val; }
|
void setCleanup(bool Val) { IsCleanup = Val; }
|
||||||
|
|
||||||
/// addClause - Add a clause to the landing pad.
|
/// addClause - Add a clause to the landing pad.
|
||||||
void addClause(ClauseType CT, Value *ClauseVal);
|
void addClause(ClauseType CT, Constant *ClauseVal);
|
||||||
|
|
||||||
/// getClauseType - Return the type of the clause at this index. The two
|
/// getClauseType - Return the type of the clause at this index. The two
|
||||||
/// supported clauses are Catch and Filter.
|
/// supported clauses are Catch and Filter.
|
||||||
@ -1862,9 +1862,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// getClauseValue - Return the value of the clause at this index.
|
/// getClauseValue - Return the value of the clause at this index.
|
||||||
Value *getClauseValue(unsigned I) const {
|
Constant *getClauseValue(unsigned I) const {
|
||||||
assert(I + 1 < getNumOperands() && "Index too large!");
|
assert(I + 1 < getNumOperands() && "Index too large!");
|
||||||
return OperandList[I + 1];
|
return cast<Constant>(OperandList[I + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getNumClauses - Get the number of clauses for this landing pad.
|
/// getNumClauses - Get the number of clauses for this landing pad.
|
||||||
|
@ -3528,7 +3528,7 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
|
|
||||||
bool IsCleanup = EatIfPresent(lltok::kw_cleanup);
|
bool IsCleanup = EatIfPresent(lltok::kw_cleanup);
|
||||||
|
|
||||||
SmallVector<std::pair<LandingPadInst::ClauseType, Value*>, 16> Clauses;
|
SmallVector<std::pair<LandingPadInst::ClauseType, Constant*>, 16> Clauses;
|
||||||
while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
|
while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
|
||||||
LandingPadInst::ClauseType CT;
|
LandingPadInst::ClauseType CT;
|
||||||
if (Lex.getKind() == lltok::kw_catch) {
|
if (Lex.getKind() == lltok::kw_catch) {
|
||||||
@ -3543,14 +3543,15 @@ bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
Value *V; LocTy VLoc;
|
Value *V; LocTy VLoc;
|
||||||
if (ParseTypeAndValue(V, VLoc, PFS))
|
if (ParseTypeAndValue(V, VLoc, PFS))
|
||||||
return true;
|
return true;
|
||||||
Clauses.push_back(std::make_pair(CT, V));
|
Clauses.push_back(std::make_pair(CT, cast<Constant>(V)));
|
||||||
} while (EatIfPresent(lltok::comma));
|
} while (EatIfPresent(lltok::comma));
|
||||||
}
|
}
|
||||||
|
|
||||||
LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, Clauses.size());
|
LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, Clauses.size());
|
||||||
LP->setCleanup(IsCleanup);
|
LP->setCleanup(IsCleanup);
|
||||||
|
|
||||||
for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType, Value*> >::iterator
|
for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType,
|
||||||
|
Constant*> >::iterator
|
||||||
I = Clauses.begin(), E = Clauses.end(); I != E; ++I)
|
I = Clauses.begin(), E = Clauses.end(); I != E; ++I)
|
||||||
LP->addClause(I->first, I->second);
|
LP->addClause(I->first, I->second);
|
||||||
|
|
||||||
|
@ -2550,7 +2550,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||||||
return Error("Invalid LANDINGPAD record");
|
return Error("Invalid LANDINGPAD record");
|
||||||
}
|
}
|
||||||
|
|
||||||
LP->addClause(CT, Val);
|
LP->addClause(CT, cast<Constant>(Val));
|
||||||
}
|
}
|
||||||
|
|
||||||
I = LP;
|
I = LP;
|
||||||
|
@ -1715,7 +1715,7 @@ void LLVMAddClause(LLVMValueRef LandingPad, LLVMLandingPadClauseTy ClauseTy,
|
|||||||
LLVMValueRef ClauseVal) {
|
LLVMValueRef ClauseVal) {
|
||||||
unwrap<LandingPadInst>(LandingPad)->
|
unwrap<LandingPadInst>(LandingPad)->
|
||||||
addClause(static_cast<LandingPadInst::ClauseType>(ClauseTy),
|
addClause(static_cast<LandingPadInst::ClauseType>(ClauseTy),
|
||||||
unwrap(ClauseVal));
|
cast<Constant>(unwrap(ClauseVal)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
|
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
|
||||||
|
@ -228,14 +228,14 @@ void LandingPadInst::reserveClauses(unsigned Size) {
|
|||||||
Use::zap(OldOps, OldOps + e, true);
|
Use::zap(OldOps, OldOps + e, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandingPadInst::addClause(ClauseType CT, Value *ClauseVal) {
|
void LandingPadInst::addClause(ClauseType CT, Constant *ClauseVal) {
|
||||||
unsigned OpNo = getNumOperands();
|
unsigned OpNo = getNumOperands();
|
||||||
if (OpNo + 1 > ReservedSpace)
|
if (OpNo + 1 > ReservedSpace)
|
||||||
growOperands();
|
growOperands();
|
||||||
assert(OpNo < ReservedSpace && "Growing didn't work!");
|
assert(OpNo < ReservedSpace && "Growing didn't work!");
|
||||||
ClauseIdxs.push_back(CT);
|
ClauseIdxs.push_back(CT);
|
||||||
++NumOperands;
|
++NumOperands;
|
||||||
OperandList[OpNo] = ClauseVal;
|
OperandList[OpNo] = (Value*)ClauseVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user