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());
|
||||
EmitAlignment(4); // FIXME: This should be parameterized somewhere.
|
||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||
if (!forCygwin && !forDarwin)
|
||||
if (forELF)
|
||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||
O << CurrentFnName << ":\n";
|
||||
|
||||
|
@ -39,15 +39,18 @@ AsmWriterFlavor("x86-asm-syntax",
|
||||
cl::init(att));
|
||||
|
||||
/// doInitialization
|
||||
bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
||||
forCygwin = false;
|
||||
bool X86SharedAsmPrinter::doInitialization(Module &M) {
|
||||
bool forCygwin = false;
|
||||
forDarwin = false;
|
||||
forELF = false;
|
||||
bool forWin32 = false;
|
||||
const std::string& TT = M.getTargetTriple();
|
||||
if (TT.length() > 5) {
|
||||
forCygwin = TT.find("cygwin") != std::string::npos ||
|
||||
TT.find("mingw") != std::string::npos;
|
||||
forDarwin = TT.find("darwin") != std::string::npos;
|
||||
if (!forDarwin && !forCygwin)
|
||||
forELF = true;
|
||||
} else if (TT.empty()) {
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
forCygwin = true;
|
||||
@ -55,6 +58,8 @@ bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
||||
forDarwin = true;
|
||||
#elif defined(_WIN32)
|
||||
forWin32 = true;
|
||||
#else
|
||||
forELF = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -139,7 +144,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
||||
}
|
||||
|
||||
EmitAlignment(Align);
|
||||
if (!forCygwin && !forDarwin) {
|
||||
if (forELF) {
|
||||
O << "\t.type " << name << ",@object\n";
|
||||
O << "\t.size " << name << "," << Size << "\n";
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ extern Statistic<> EmittedInsts;
|
||||
|
||||
struct X86SharedAsmPrinter : public AsmPrinter {
|
||||
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 doFinalization(Module &M);
|
||||
|
||||
bool forCygwin;
|
||||
bool forELF;
|
||||
bool forDarwin;
|
||||
|
||||
// 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());
|
||||
EmitAlignment(4);
|
||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||
if (!forCygwin && !forDarwin)
|
||||
if (forELF)
|
||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||
O << CurrentFnName << ":\n";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user