restructure code a bit to make use of continue (simplifying things). Generalize

the .zerofill directive emission to not be darwin-specific


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33304 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-01-17 17:44:25 +00:00
parent 42ca450a57
commit 8e13e90052

View File

@@ -138,18 +138,26 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
unsigned Size = TD->getTypeSize(C->getType());
unsigned Align = TD->getPreferredAlignmentLog(I);
if (C->isNullValue() && /* FIXME: Verify correct */
!I->hasSection() &&
(I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage() ||
(Subtarget->isTargetDarwin() &&
I->hasExternalLinkage()))) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (I->hasHiddenVisibility())
if (const char *Directive = TAI->getHiddenDirective())
O << Directive << name << "\n";
if (Subtarget->isTargetELF())
O << "\t.type " << name << ",@object\n";
if (C->isNullValue()) {
if (I->hasExternalLinkage()) {
if (const char *Directive = TAI->getZeroFillDirective()) {
O << "\t.globl\t" << name << "\n";
O << "\t.zerofill __DATA__, __common, " << name << ", "
O << Directive << "__DATA__, __common, " << name << ", "
<< Size << ", " << Align;
} else {
continue;
}
}
if (!I->hasSection() &&
(I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (!NoZerosInBSS && TAI->getBSSSection())
SwitchToDataSection(TAI->getBSSSection(), I);
else
@@ -170,9 +178,11 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
if (TAI->getCOMMDirectiveTakesAlignment())
O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
}
O << "\t\t" << TAI->getCommentString() << " " << I->getName() << "\n";
} else {
continue;
}
}
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
case GlobalValue::WeakLinkage:
@@ -254,13 +264,6 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
EmitGlobalConstant(C);
O << '\n';
}
if (I->hasHiddenVisibility())
if (const char *Directive = TAI->getHiddenDirective())
O << Directive << name << "\n";
if (Subtarget->isTargetELF())
O << "\t.type " << name << ",@object\n";
}
// Output linker support code for dllexported globals
if (DLLExportedGVs.begin() != DLLExportedGVs.end()) {