summaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-24 06:21:22 +0000
committerChris Lattner <sabre@nondot.org>2001-10-24 06:21:22 +0000
commit7eadfa1db8d463576470afa9d98ae7fec65aa9ec (patch)
tree181e6394c27803e06180b6dd959a61e7521835b2 /lib/Bytecode
parentf608608878d0eff705c7f8f83e5393d7db427b19 (diff)
downloadllvm-7eadfa1db8d463576470afa9d98ae7fec65aa9ec.tar.gz
llvm-7eadfa1db8d463576470afa9d98ae7fec65aa9ec.tar.bz2
llvm-7eadfa1db8d463576470afa9d98ae7fec65aa9ec.tar.xz
Frivolous cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/ConstantReader.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp
index 13f8747cb7..fcf92fa536 100644
--- a/lib/Bytecode/Reader/ConstantReader.cpp
+++ b/lib/Bytecode/Reader/ConstantReader.cpp
@@ -48,8 +48,7 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
if (isVarArg) Params.pop_back();
- Val = MethodType::get(RetType, Params, isVarArg);
- break;
+ return MethodType::get(RetType, Params, isVarArg);
}
case Type::ArrayTyID: {
unsigned ElTyp;
@@ -59,8 +58,10 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
int NumElements;
if (read_vbr(Buf, EndBuf, NumElements)) return failure(Val);
- Val = ArrayType::get(ElementType, NumElements);
- break;
+
+ BCR_TRACE(5, "Array Type Constant #" << ElTyp << " size="
+ << NumElements << endl);
+ return ArrayType::get(ElementType, NumElements);
}
case Type::StructTyID: {
unsigned Typ;
@@ -75,30 +76,26 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
}
- Val = StructType::get(Elements);
- break;
+ return StructType::get(Elements);
}
case Type::PointerTyID: {
unsigned ElTyp;
if (read_vbr(Buf, EndBuf, ElTyp)) return failure(Val);
+ BCR_TRACE(5, "Pointer Type Constant #" << (ElTyp-14) << endl);
const Type *ElementType = getType(ElTyp);
if (ElementType == 0) return failure(Val);
- Val = PointerType::get(ElementType);
- break;
+ return PointerType::get(ElementType);
}
case Type::OpaqueTyID: {
- Val = OpaqueType::get();
- break;
+ return OpaqueType::get();
}
default:
cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to deserialize"
- << " primitive Type " << PrimType << "\n";
+ << " primitive Type " << PrimType << "\n";
return failure(Val);
}
-
- return Val;
}
// refineAbstractType - The callback method is invoked when one of the
@@ -137,16 +134,17 @@ bool BytecodeParser::parseTypeConstants(const uchar *&Buf, const uchar *EndBuf,
assert(Tab.size() == 0 && "should not have read type constants in before!");
// Insert a bunch of opaque types to be resolved later...
- for (unsigned i = 0; i < NumEntries; i++)
+ for (unsigned i = 0; i < NumEntries; ++i)
Tab.push_back(PATypeHandle<Type>(OpaqueType::get(), this));
// Loop through reading all of the types. Forward types will make use of the
// opaque types just inserted.
//
- for (unsigned i = 0; i < NumEntries; i++) {
+ for (unsigned i = 0; i < NumEntries; ++i) {
const Type *NewTy = parseTypeConstant(Buf, EndBuf), *OldTy = Tab[i].get();
if (NewTy == 0) return failure(true);
- BCR_TRACE(4, "Read Type Constant: '" << NewTy << "'\n");
+ BCR_TRACE(4, "#" << i << ": Read Type Constant: '" << NewTy <<
+ "' Replacing: " << OldTy << "\n");
// Don't insertValue the new type... instead we want to replace the opaque
// type with the new concrete value...
@@ -164,7 +162,7 @@ bool BytecodeParser::parseTypeConstants(const uchar *&Buf, const uchar *EndBuf,
}
BCR_TRACE(5, "Resulting types:\n");
- for (unsigned i = 0; i < NumEntries; i++) {
+ for (unsigned i = 0; i < NumEntries; ++i) {
BCR_TRACE(5, cast<const Type>(Tab[i]) << "\n");
}
return false;
@@ -347,7 +345,7 @@ bool BytecodeParser::ParseConstantPool(const uchar *&Buf, const uchar *EndBuf,
if (Typ == Type::TypeTyID) {
if (parseTypeConstants(Buf, EndBuf, TypeTab, NumEntries)) return true;
} else {
- for (unsigned i = 0; i < NumEntries; i++) {
+ for (unsigned i = 0; i < NumEntries; ++i) {
ConstPoolVal *I;
if (parseConstPoolValue(Buf, EndBuf, Ty, I)) return failure(true);
BCR_TRACE(4, "Read Constant: '" << I << "'\n");