mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from the value table before reading functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -408,10 +408,10 @@ bool BitcodeReader::ResolveGlobalAndAliasInits() {
|
||||
AliasInitWorklist.swap(AliasInits);
|
||||
|
||||
while (!GlobalInitWorklist.empty()) {
|
||||
unsigned ValID = GlobalInits.back().second;
|
||||
unsigned ValID = GlobalInitWorklist.back().second;
|
||||
if (ValID >= ValueList.size()) {
|
||||
// Not ready to resolve this yet, it requires something later in the file.
|
||||
GlobalInitWorklist.push_back(GlobalInits.back());
|
||||
GlobalInits.push_back(GlobalInitWorklist.back());
|
||||
} else {
|
||||
if (Constant *C = dyn_cast<Constant>(ValueList[ValID]))
|
||||
GlobalInitWorklist.back().first->setInitializer(C);
|
||||
@ -826,7 +826,7 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
|
||||
break;
|
||||
}
|
||||
// ALIAS: [alias type, aliasee val#, linkage]
|
||||
case bitc::MODULE_CODE_ALIAS:
|
||||
case bitc::MODULE_CODE_ALIAS: {
|
||||
if (Record.size() < 3)
|
||||
return Error("Invalid MODULE_ALIAS record");
|
||||
const Type *Ty = getTypeByID(Record[0]);
|
||||
@ -839,6 +839,14 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
|
||||
AliasInits.push_back(std::make_pair(NewGA, Record[1]));
|
||||
break;
|
||||
}
|
||||
/// MODULE_CODE_PURGEVALS: [numvals]
|
||||
case bitc::MODULE_CODE_PURGEVALS:
|
||||
// Trim down the value list to the specified size.
|
||||
if (Record.size() < 1 || Record[0] > ValueList.size())
|
||||
return Error("Invalid MODULE_PURGEVALS record");
|
||||
ValueList.shrinkTo(Record[0]);
|
||||
break;
|
||||
}
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,11 @@ public:
|
||||
Value *back() const { return Uses.back(); }
|
||||
void pop_back() { Uses.pop_back(); --NumOperands; }
|
||||
bool empty() const { return NumOperands == 0; }
|
||||
void shrinkTo(unsigned N) {
|
||||
assert(N < NumOperands && "Invalid shrinkTo request!");
|
||||
Uses.resize(N);
|
||||
NumOperands = N;
|
||||
}
|
||||
virtual void print(std::ostream&) const {}
|
||||
|
||||
Constant *getConstantFwdRef(unsigned Idx, const Type *Ty);
|
||||
|
Reference in New Issue
Block a user