mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Fix crazy indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,12 +31,12 @@ Statistic<> llvm::x86::EmittedInsts("asm-printer",
|
|||||||
enum AsmWriterFlavorTy { att, intel };
|
enum AsmWriterFlavorTy { att, intel };
|
||||||
cl::opt<AsmWriterFlavorTy>
|
cl::opt<AsmWriterFlavorTy>
|
||||||
AsmWriterFlavor("x86-asm-syntax",
|
AsmWriterFlavor("x86-asm-syntax",
|
||||||
cl::desc("Choose style of code to emit from X86 backend:"),
|
cl::desc("Choose style of code to emit from X86 backend:"),
|
||||||
cl::values(
|
cl::values(
|
||||||
clEnumVal(att, " Emit AT&T-style assembly"),
|
clEnumVal(att, " Emit AT&T-style assembly"),
|
||||||
clEnumVal(intel, " Emit Intel-style assembly"),
|
clEnumVal(intel, " Emit Intel-style assembly"),
|
||||||
clEnumValEnd),
|
clEnumValEnd),
|
||||||
cl::init(att));
|
cl::init(att));
|
||||||
|
|
||||||
/// doInitialization
|
/// doInitialization
|
||||||
bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
||||||
@@ -48,15 +48,15 @@ bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
|||||||
TT.find("mingw") != std::string::npos;
|
TT.find("mingw") != std::string::npos;
|
||||||
forDarwin = TT.find("darwin") != std::string::npos;
|
forDarwin = TT.find("darwin") != std::string::npos;
|
||||||
} else if (TT.empty()) {
|
} else if (TT.empty()) {
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||||
forCygwin = true;
|
forCygwin = true;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
forDarwin = true;
|
forDarwin = true;
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
leadingUnderscore = true;
|
leadingUnderscore = true;
|
||||||
#else
|
#else
|
||||||
leadingUnderscore = false;
|
leadingUnderscore = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (leadingUnderscore || forCygwin || forDarwin)
|
if (leadingUnderscore || forCygwin || forDarwin)
|
||||||
GlobalPrefix = "_";
|
GlobalPrefix = "_";
|
||||||
@@ -95,76 +95,74 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
|||||||
std::string CurSection;
|
std::string CurSection;
|
||||||
|
|
||||||
// Print out module-level global variables here.
|
// Print out module-level global variables here.
|
||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
|
for (Module::const_global_iterator I = M.global_begin(),
|
||||||
if (I->hasInitializer()) { // External global require no code
|
E = M.global_end(); I != E; ++I)
|
||||||
O << "\n\n";
|
if (I->hasInitializer()) { // External global require no code
|
||||||
std::string name = Mang->getValueName(I);
|
O << "\n\n";
|
||||||
Constant *C = I->getInitializer();
|
std::string name = Mang->getValueName(I);
|
||||||
unsigned Size = TD.getTypeSize(C->getType());
|
Constant *C = I->getInitializer();
|
||||||
unsigned Align = TD.getTypeAlignmentShift(C->getType());
|
unsigned Size = TD.getTypeSize(C->getType());
|
||||||
|
unsigned Align = TD.getTypeAlignmentShift(C->getType());
|
||||||
if (C->isNullValue() &&
|
|
||||||
(I->hasLinkOnceLinkage() || I->hasInternalLinkage() ||
|
if (C->isNullValue() &&
|
||||||
I->hasWeakLinkage() /* FIXME: Verify correct */)) {
|
(I->hasLinkOnceLinkage() || I->hasInternalLinkage() ||
|
||||||
SwitchSection(O, CurSection, ".data");
|
I->hasWeakLinkage() /* FIXME: Verify correct */)) {
|
||||||
if (!forCygwin && !forDarwin && I->hasInternalLinkage())
|
SwitchSection(O, CurSection, ".data");
|
||||||
O << "\t.local " << name << "\n";
|
if (!forCygwin && !forDarwin && I->hasInternalLinkage())
|
||||||
if (forDarwin && I->hasInternalLinkage())
|
O << "\t.local " << name << "\n";
|
||||||
O << "\t.lcomm " << name << "," << Size << "," << Align;
|
if (forDarwin && I->hasInternalLinkage())
|
||||||
else
|
O << "\t.lcomm " << name << "," << Size << "," << Align;
|
||||||
O << "\t.comm " << name << "," << Size;
|
else
|
||||||
if (!forCygwin && !forDarwin)
|
O << "\t.comm " << name << "," << Size;
|
||||||
O << "," << (1 << Align);
|
if (!forCygwin && !forDarwin)
|
||||||
O << "\t\t# ";
|
O << "," << (1 << Align);
|
||||||
WriteAsOperand(O, I, true, true, &M);
|
O << "\t\t# ";
|
||||||
O << "\n";
|
WriteAsOperand(O, I, true, true, &M);
|
||||||
} else {
|
O << "\n";
|
||||||
switch (I->getLinkage()) {
|
} else {
|
||||||
case GlobalValue::LinkOnceLinkage:
|
switch (I->getLinkage()) {
|
||||||
case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak.
|
default: assert(0 && "Unknown linkage type!");
|
||||||
// Nonnull linkonce -> weak
|
case GlobalValue::LinkOnceLinkage:
|
||||||
O << "\t.weak " << name << "\n";
|
case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak.
|
||||||
SwitchSection(O, CurSection, "");
|
// Nonnull linkonce -> weak
|
||||||
O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n";
|
O << "\t.weak " << name << "\n";
|
||||||
break;
|
SwitchSection(O, CurSection, "");
|
||||||
case GlobalValue::AppendingLinkage:
|
O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n";
|
||||||
// FIXME: appending linkage variables should go into a section of
|
break;
|
||||||
// their name or something. For now, just emit them as external.
|
case GlobalValue::AppendingLinkage:
|
||||||
case GlobalValue::ExternalLinkage:
|
// FIXME: appending linkage variables should go into a section of
|
||||||
// If external or appending, declare as a global symbol
|
// their name or something. For now, just emit them as external.
|
||||||
O << "\t.globl " << name << "\n";
|
case GlobalValue::ExternalLinkage:
|
||||||
// FALL THROUGH
|
// If external or appending, declare as a global symbol
|
||||||
case GlobalValue::InternalLinkage:
|
O << "\t.globl " << name << "\n";
|
||||||
if (C->isNullValue())
|
// FALL THROUGH
|
||||||
SwitchSection(O, CurSection, ".bss");
|
case GlobalValue::InternalLinkage:
|
||||||
else
|
if (C->isNullValue())
|
||||||
SwitchSection(O, CurSection, ".data");
|
SwitchSection(O, CurSection, ".bss");
|
||||||
break;
|
else
|
||||||
case GlobalValue::GhostLinkage:
|
SwitchSection(O, CurSection, ".data");
|
||||||
std::cerr << "GhostLinkage cannot appear in X86AsmPrinter!\n";
|
break;
|
||||||
abort();
|
}
|
||||||
}
|
|
||||||
|
emitAlignment(Align);
|
||||||
emitAlignment(Align);
|
if (!forCygwin && !forDarwin) {
|
||||||
if (!forCygwin && !forDarwin) {
|
O << "\t.type " << name << ",@object\n";
|
||||||
O << "\t.type " << name << ",@object\n";
|
O << "\t.size " << name << "," << Size << "\n";
|
||||||
O << "\t.size " << name << "," << Size << "\n";
|
}
|
||||||
}
|
O << name << ":\t\t\t\t# ";
|
||||||
O << name << ":\t\t\t\t# ";
|
WriteAsOperand(O, I, true, true, &M);
|
||||||
WriteAsOperand(O, I, true, true, &M);
|
O << " = ";
|
||||||
O << " = ";
|
WriteAsOperand(O, C, false, false, &M);
|
||||||
WriteAsOperand(O, C, false, false, &M);
|
O << "\n";
|
||||||
O << "\n";
|
emitGlobalConstant(C);
|
||||||
emitGlobalConstant(C);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forDarwin) {
|
if (forDarwin) {
|
||||||
// Output stubs for dynamically-linked functions
|
// Output stubs for dynamically-linked functions
|
||||||
unsigned j = 1;
|
unsigned j = 1;
|
||||||
for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
||||||
i != e; ++i, ++j)
|
i != e; ++i, ++j) {
|
||||||
{
|
|
||||||
O << "\t.symbol_stub\n";
|
O << "\t.symbol_stub\n";
|
||||||
O << "L" << *i << "$stub:\n";
|
O << "L" << *i << "$stub:\n";
|
||||||
O << "\t.indirect_symbol " << *i << "\n";
|
O << "\t.indirect_symbol " << *i << "\n";
|
||||||
|
Reference in New Issue
Block a user