summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/EmitAssembly.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-03-31 19:03:58 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-03-31 19:03:58 +0000
commit07c874547bd7fa6ccf0e9d9419b0ebf197f8d6fc (patch)
treea80cbbbb2302e95db1aab559f2eebdabe9be8f78 /llvm/lib/Target/Sparc/EmitAssembly.cpp
parent429621cad000461601feab3b2204bf1159f85a6b (diff)
downloadbcm5719-llvm-07c874547bd7fa6ccf0e9d9419b0ebf197f8d6fc.tar.gz
bcm5719-llvm-07c874547bd7fa6ccf0e9d9419b0ebf197f8d6fc.zip
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. llvm-svn: 2073
Diffstat (limited to 'llvm/lib/Target/Sparc/EmitAssembly.cpp')
-rw-r--r--llvm/lib/Target/Sparc/EmitAssembly.cpp46
1 files changed, 14 insertions, 32 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index ae61b8d8e19..91570444830 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp
@@ -303,7 +303,7 @@ SparcMethodAsmPrinter::printOneOperand(const MachineOperand &op)
{
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()) {
toAsm << "<NULL VALUE>";
} else {
@@ -732,47 +732,29 @@ void SparcModuleAsmPrinter::emitGlobalsAndConstants(const Module *M) {
// 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!
- //
- // Read-only data section (implies initialized)
+
+ // Section 1 : Read-only data section (implies initialized)
+ enterSection(AsmPrinter::ReadOnlyData);
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);
- printGlobalVariable(GV);
- }
- }
+ if ((*GI)->hasInitializer() && (*GI)->isConstant())
+ printGlobalVariable(*GI);
for (std::hash_set<const Constant*>::const_iterator
I = moduleConstants.begin(),
E = moduleConstants.end(); I != E; ++I)
printConstant(*I);
- // Initialized read-write data section
+ // Section 2 : Initialized read-write data section
+ enterSection(AsmPrinter::InitRWData);
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);
- printGlobalVariable(GV);
- }
- }
+ if ((*GI)->hasInitializer() && ! (*GI)->isConstant())
+ printGlobalVariable(*GI);
- // Uninitialized read-write data section
+ // Section 3 : Uninitialized read-write data section
+ enterSection(AsmPrinter::UninitRWData);
for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
- {
- const GlobalVariable* GV = *GI;
- if (! GV->hasInitializer())
- {
- if (GI == M->gbegin())
- enterSection(AsmPrinter::UninitRWData);
- printGlobalVariable(GV);
- }
- }
+ if (! (*GI)->hasInitializer())
+ printGlobalVariable(*GI);
toAsm << "\n";
}
OpenPOWER on IntegriCloud