mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Add a forELF flag, allowing the removal of forCygwin and simplification of
conditionals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
02d09206ee
commit
5df14ca0a1
@ -35,7 +35,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
SwitchSection("\t.text\n", MF.getFunction());
|
SwitchSection("\t.text\n", MF.getFunction());
|
||||||
EmitAlignment(4); // FIXME: This should be parameterized somewhere.
|
EmitAlignment(4); // FIXME: This should be parameterized somewhere.
|
||||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||||
if (!forCygwin && !forDarwin)
|
if (forELF)
|
||||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||||
O << CurrentFnName << ":\n";
|
O << CurrentFnName << ":\n";
|
||||||
|
|
||||||
|
@ -39,15 +39,18 @@ AsmWriterFlavor("x86-asm-syntax",
|
|||||||
cl::init(att));
|
cl::init(att));
|
||||||
|
|
||||||
/// doInitialization
|
/// doInitialization
|
||||||
bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
bool X86SharedAsmPrinter::doInitialization(Module &M) {
|
||||||
forCygwin = false;
|
bool forCygwin = false;
|
||||||
forDarwin = false;
|
forDarwin = false;
|
||||||
|
forELF = false;
|
||||||
bool forWin32 = false;
|
bool forWin32 = false;
|
||||||
const std::string& TT = M.getTargetTriple();
|
const std::string& TT = M.getTargetTriple();
|
||||||
if (TT.length() > 5) {
|
if (TT.length() > 5) {
|
||||||
forCygwin = TT.find("cygwin") != std::string::npos ||
|
forCygwin = TT.find("cygwin") != std::string::npos ||
|
||||||
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;
|
||||||
|
if (!forDarwin && !forCygwin)
|
||||||
|
forELF = true;
|
||||||
} else if (TT.empty()) {
|
} else if (TT.empty()) {
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||||
forCygwin = true;
|
forCygwin = true;
|
||||||
@ -55,6 +58,8 @@ bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
|||||||
forDarwin = true;
|
forDarwin = true;
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
forWin32 = true;
|
forWin32 = true;
|
||||||
|
#else
|
||||||
|
forELF = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +144,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmitAlignment(Align);
|
EmitAlignment(Align);
|
||||||
if (!forCygwin && !forDarwin) {
|
if (forELF) {
|
||||||
O << "\t.type " << name << ",@object\n";
|
O << "\t.type " << name << ",@object\n";
|
||||||
O << "\t.size " << name << "," << Size << "\n";
|
O << "\t.size " << name << "," << Size << "\n";
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ extern Statistic<> EmittedInsts;
|
|||||||
|
|
||||||
struct X86SharedAsmPrinter : public AsmPrinter {
|
struct X86SharedAsmPrinter : public AsmPrinter {
|
||||||
X86SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
|
X86SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
|
||||||
: AsmPrinter(O, TM), forCygwin(false), forDarwin(false) { }
|
: AsmPrinter(O, TM), forELF(false), forDarwin(false) { }
|
||||||
|
|
||||||
bool doInitialization(Module &M);
|
bool doInitialization(Module &M);
|
||||||
bool doFinalization(Module &M);
|
bool doFinalization(Module &M);
|
||||||
|
|
||||||
bool forCygwin;
|
bool forELF;
|
||||||
bool forDarwin;
|
bool forDarwin;
|
||||||
|
|
||||||
// Necessary for Darwin to print out the apprioriate types of linker stubs
|
// Necessary for Darwin to print out the apprioriate types of linker stubs
|
||||||
|
@ -35,7 +35,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
SwitchSection("\t.text\n", MF.getFunction());
|
SwitchSection("\t.text\n", MF.getFunction());
|
||||||
EmitAlignment(4);
|
EmitAlignment(4);
|
||||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||||
if (!forCygwin && !forDarwin)
|
if (forELF)
|
||||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||||
O << CurrentFnName << ":\n";
|
O << CurrentFnName << ":\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user