mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 17:38:39 +00:00
Don't print global variable definitions twice! Sun's pathetic compiler
never complained about this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0e9843db54
commit
913bfbc2e4
@ -522,11 +522,13 @@ void CWriter::printModule(Module *M) {
|
|||||||
|
|
||||||
// Global variable declarations...
|
// Global variable declarations...
|
||||||
if (!M->gempty()) {
|
if (!M->gempty()) {
|
||||||
Out << "\n/* Global Variable Declarations */\n";
|
Out << "\n/* External Global Variable Declarations */\n";
|
||||||
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
||||||
Out << (I->hasExternalLinkage() ? "extern " : "static ");
|
if (I->hasExternalLinkage()) {
|
||||||
printType(I->getType()->getElementType(), getValueName(I));
|
Out << "extern ";
|
||||||
Out << ";\n";
|
printType(I->getType()->getElementType(), getValueName(I));
|
||||||
|
Out << ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,11 +541,13 @@ void CWriter::printModule(Module *M) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output the global variable contents...
|
// Output the global variable definitions and contents...
|
||||||
if (!M->gempty()) {
|
if (!M->gempty()) {
|
||||||
Out << "\n\n/* Global Data */\n";
|
Out << "\n\n/* Global Variable Definitions and Initialization */\n";
|
||||||
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
||||||
if (I->hasInternalLinkage()) Out << "static ";
|
if (I->hasExternalLinkage())
|
||||||
|
continue; // printed above!
|
||||||
|
Out << "static ";
|
||||||
printType(I->getType()->getElementType(), getValueName(I));
|
printType(I->getType()->getElementType(), getValueName(I));
|
||||||
|
|
||||||
if (I->hasInitializer()) {
|
if (I->hasInitializer()) {
|
||||||
|
@ -522,11 +522,13 @@ void CWriter::printModule(Module *M) {
|
|||||||
|
|
||||||
// Global variable declarations...
|
// Global variable declarations...
|
||||||
if (!M->gempty()) {
|
if (!M->gempty()) {
|
||||||
Out << "\n/* Global Variable Declarations */\n";
|
Out << "\n/* External Global Variable Declarations */\n";
|
||||||
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
||||||
Out << (I->hasExternalLinkage() ? "extern " : "static ");
|
if (I->hasExternalLinkage()) {
|
||||||
printType(I->getType()->getElementType(), getValueName(I));
|
Out << "extern ";
|
||||||
Out << ";\n";
|
printType(I->getType()->getElementType(), getValueName(I));
|
||||||
|
Out << ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,11 +541,13 @@ void CWriter::printModule(Module *M) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output the global variable contents...
|
// Output the global variable definitions and contents...
|
||||||
if (!M->gempty()) {
|
if (!M->gempty()) {
|
||||||
Out << "\n\n/* Global Data */\n";
|
Out << "\n\n/* Global Variable Definitions and Initialization */\n";
|
||||||
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
|
||||||
if (I->hasInternalLinkage()) Out << "static ";
|
if (I->hasExternalLinkage())
|
||||||
|
continue; // printed above!
|
||||||
|
Out << "static ";
|
||||||
printType(I->getType()->getElementType(), getValueName(I));
|
printType(I->getType()->getElementType(), getValueName(I));
|
||||||
|
|
||||||
if (I->hasInitializer()) {
|
if (I->hasInitializer()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user