mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Minor cleanup in printing constants. I think this included a bug
fix related to putting a read-write variable in a read-only section, but I'm not sure now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -303,7 +303,7 @@ SparcMethodAsmPrinter::printOneOperand(const MachineOperand &op)
|
|||||||
{
|
{
|
||||||
int RegNum = (int)op.getAllocatedRegNum();
|
int RegNum = (int)op.getAllocatedRegNum();
|
||||||
|
|
||||||
// ****this code is temporary till NULL Values are fixed
|
// better to print code with NULL registers than to die
|
||||||
if (RegNum == Target.getRegInfo().getInvalidRegNum()) {
|
if (RegNum == Target.getRegInfo().getInvalidRegNum()) {
|
||||||
toAsm << "<NULL VALUE>";
|
toAsm << "<NULL VALUE>";
|
||||||
} else {
|
} else {
|
||||||
@@ -732,47 +732,29 @@ void SparcModuleAsmPrinter::emitGlobalsAndConstants(const Module *M) {
|
|||||||
|
|
||||||
// Now, emit the three data sections separately; the cost of I/O should
|
// Now, emit the three data sections separately; the cost of I/O should
|
||||||
// make up for the cost of extra passes over the globals list!
|
// make up for the cost of extra passes over the globals list!
|
||||||
//
|
|
||||||
// Read-only data section (implies initialized)
|
// Section 1 : Read-only data section (implies initialized)
|
||||||
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
|
||||||
{
|
|
||||||
const GlobalVariable* GV = *GI;
|
|
||||||
if (GV->hasInitializer() && GV->isConstant())
|
|
||||||
{
|
|
||||||
if (GI == M->gbegin())
|
|
||||||
enterSection(AsmPrinter::ReadOnlyData);
|
enterSection(AsmPrinter::ReadOnlyData);
|
||||||
printGlobalVariable(GV);
|
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
||||||
}
|
if ((*GI)->hasInitializer() && (*GI)->isConstant())
|
||||||
}
|
printGlobalVariable(*GI);
|
||||||
|
|
||||||
for (std::hash_set<const Constant*>::const_iterator
|
for (std::hash_set<const Constant*>::const_iterator
|
||||||
I = moduleConstants.begin(),
|
I = moduleConstants.begin(),
|
||||||
E = moduleConstants.end(); I != E; ++I)
|
E = moduleConstants.end(); I != E; ++I)
|
||||||
printConstant(*I);
|
printConstant(*I);
|
||||||
|
|
||||||
// Initialized read-write data section
|
// Section 2 : Initialized read-write data section
|
||||||
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
|
||||||
{
|
|
||||||
const GlobalVariable* GV = *GI;
|
|
||||||
if (GV->hasInitializer() && ! GV->isConstant())
|
|
||||||
{
|
|
||||||
if (GI == M->gbegin())
|
|
||||||
enterSection(AsmPrinter::InitRWData);
|
enterSection(AsmPrinter::InitRWData);
|
||||||
printGlobalVariable(GV);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uninitialized read-write data section
|
|
||||||
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
||||||
{
|
if ((*GI)->hasInitializer() && ! (*GI)->isConstant())
|
||||||
const GlobalVariable* GV = *GI;
|
printGlobalVariable(*GI);
|
||||||
if (! GV->hasInitializer())
|
|
||||||
{
|
// Section 3 : Uninitialized read-write data section
|
||||||
if (GI == M->gbegin())
|
|
||||||
enterSection(AsmPrinter::UninitRWData);
|
enterSection(AsmPrinter::UninitRWData);
|
||||||
printGlobalVariable(GV);
|
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
||||||
}
|
if (! (*GI)->hasInitializer())
|
||||||
}
|
printGlobalVariable(*GI);
|
||||||
|
|
||||||
toAsm << "\n";
|
toAsm << "\n";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user