mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Fix bug: Assembler/2003-05-03-BytecodeReaderProblem.llx
by emitting the type planes before any constants (which could be constant expressions involving undefined types!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2602f3dfd
commit
f69315bd79
@ -126,14 +126,22 @@ void BytecodeWriter::outputConstants(bool isFunction) {
|
||||
|
||||
unsigned NumPlanes = Table.getNumPlanes();
|
||||
|
||||
for (unsigned pno = 0; pno != NumPlanes; pno++) {
|
||||
// Output the type plane before any constants!
|
||||
if (isFunction && NumPlanes > Type::TypeTyID) {
|
||||
const std::vector<const Value*> &Plane = Table.getPlane(Type::TypeTyID);
|
||||
if (!Plane.empty()) { // Skip empty type planes...
|
||||
unsigned ValNo = Table.getModuleLevel(Type::TypeTyID);
|
||||
outputConstantsInPlane(Plane, ValNo);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned pno = 0; pno != NumPlanes; pno++)
|
||||
if (pno != Type::TypeTyID) { // Type plane handled above.
|
||||
const std::vector<const Value*> &Plane = Table.getPlane(pno);
|
||||
if (!Plane.empty()) { // Skip empty type planes...
|
||||
unsigned ValNo = 0;
|
||||
if (isFunction) // Don't reemit module constants
|
||||
ValNo += Table.getModuleLevel(pno);
|
||||
else if (pno == Type::TypeTyID) // If type plane wasn't written out above
|
||||
continue;
|
||||
|
||||
if (pno >= Type::FirstDerivedTyID) {
|
||||
// Skip zero initializer
|
||||
@ -141,7 +149,8 @@ void BytecodeWriter::outputConstants(bool isFunction) {
|
||||
ValNo = 1;
|
||||
}
|
||||
|
||||
outputConstantsInPlane(Plane, ValNo); // Write out constants in the plane
|
||||
// Write out constants in the plane
|
||||
outputConstantsInPlane(Plane, ValNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user