mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Convert more code to use new style casts
Eliminate old style casts from value.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@696 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -241,8 +241,8 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf,
|
||||
unsigned Slot;
|
||||
if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
|
||||
Value *V = getValue(AT->getElementType(), Slot, false);
|
||||
if (!V || !V->isConstant()) return failure(true);
|
||||
Elements.push_back((ConstPoolVal*)V);
|
||||
if (!V || !isa<ConstPoolVal>(V)) return failure(true);
|
||||
Elements.push_back(cast<ConstPoolVal>(V));
|
||||
}
|
||||
V = ConstPoolArray::get(AT, Elements);
|
||||
break;
|
||||
@@ -257,9 +257,9 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf,
|
||||
unsigned Slot;
|
||||
if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
|
||||
Value *V = getValue(ET[i], Slot, false);
|
||||
if (!V || !V->isConstant())
|
||||
if (!V || !isa<ConstPoolVal>(V))
|
||||
return failure(true);
|
||||
Elements.push_back((ConstPoolVal*)V);
|
||||
Elements.push_back(cast<ConstPoolVal>(V));
|
||||
}
|
||||
|
||||
V = ConstPoolStruct::get(ST, Elements);
|
||||
|
||||
@@ -266,25 +266,25 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
|
||||
case 0: cerr << "Invalid load encountered!\n"; return failure(true);
|
||||
case 1: break;
|
||||
case 2: V = getValue(Type::UByteTy, Raw.Arg2);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
break;
|
||||
case 3: V = getValue(Type::UByteTy, Raw.Arg2);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
V = getValue(Type::UByteTy, Raw.Arg3);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
break;
|
||||
default:
|
||||
V = getValue(Type::UByteTy, Raw.Arg2);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
vector<unsigned> &args = *Raw.VarArgs;
|
||||
for (unsigned i = 0, E = args.size(); i != E; ++i) {
|
||||
V = getValue(Type::UByteTy, args[i]);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
}
|
||||
delete Raw.VarArgs;
|
||||
break;
|
||||
@@ -304,15 +304,15 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
|
||||
case 1: cerr << "Invalid store encountered!\n"; return failure(true);
|
||||
case 2: break;
|
||||
case 3: V = getValue(Type::UByteTy, Raw.Arg3);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
break;
|
||||
default:
|
||||
vector<unsigned> &args = *Raw.VarArgs;
|
||||
for (unsigned i = 0, E = args.size(); i != E; ++i) {
|
||||
V = getValue(Type::UByteTy, args[i]);
|
||||
if (!V->isConstant()) return failure(true);
|
||||
Idx.push_back(V->castConstant());
|
||||
if (!isa<ConstPoolVal>(V)) return failure(true);
|
||||
Idx.push_back(cast<ConstPoolVal>(V));
|
||||
}
|
||||
delete Raw.VarArgs;
|
||||
break;
|
||||
|
||||
@@ -206,7 +206,7 @@ bool BytecodeParser::ParseSymbolTable(const uchar *&Buf, const uchar *EndBuf,
|
||||
return failure(true);
|
||||
}
|
||||
BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << D;
|
||||
if (!D->isInstruction()) cerr << endl);
|
||||
if (!isa<Instruction>(D)) cerr << endl);
|
||||
|
||||
D->setName(Name, ST);
|
||||
}
|
||||
@@ -291,7 +291,7 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
|
||||
|
||||
Value *MethPHolder = getValue(MTy, MethSlot, false);
|
||||
assert(MethPHolder && "Something is broken no placeholder found!");
|
||||
assert(MethPHolder->isMethod() && "Not a method?");
|
||||
assert(isa<Method>(MethPHolder) && "Not a method?");
|
||||
|
||||
unsigned type; // Type slot
|
||||
assert(!getTypeSlot(MTy, type) && "How can meth type not exist?");
|
||||
@@ -359,7 +359,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
|
||||
if (read_vbr(Buf, End, MethSignature)) return failure(true);
|
||||
while (MethSignature != Type::VoidTyID) { // List is terminated by Void
|
||||
const Type *Ty = getType(MethSignature);
|
||||
if (!Ty || !Ty->isMethodType()) {
|
||||
if (!Ty || !isa<MethodType>(Ty)) {
|
||||
cerr << "Method not meth type! Ty = " << Ty << endl;
|
||||
return failure(true);
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ struct BBPlaceHolderHelper : public BasicBlock {
|
||||
|
||||
struct MethPlaceHolderHelper : public Method {
|
||||
MethPlaceHolderHelper(const Type *Ty)
|
||||
: Method((const MethodType*)Ty) {
|
||||
assert(Ty->isMethodType() && "Method placeholders must be method types!");
|
||||
: Method(cast<const MethodType>(Ty)) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user