diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-25 15:06:56 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-25 15:06:56 +0000 |
commit | 86b535b085e4ea3f8d1ea759f2610dd15ac26d94 (patch) | |
tree | be33277455519f7c1289f77fabd56d6d6689c908 /lib/Target/Mips/MipsAsmPrinter.cpp | |
parent | 754b83a51a89a2a8563563aae756ce86c55b684c (diff) | |
download | llvm-86b535b085e4ea3f8d1ea759f2610dd15ac26d94.tar.gz llvm-86b535b085e4ea3f8d1ea759f2610dd15ac26d94.tar.bz2 llvm-86b535b085e4ea3f8d1ea759f2610dd15ac26d94.tar.xz |
This reverts commit r200064 and r200051.
r200064 depends on r200051.
r200051 is broken: I tries to replace .mips_hack_elf_flags, which is a good
thing, but what it replaces it with is even worse.
The new emitMipsELFFlags it adds corresponds to no assembly directive, is not
marked as a hack and is not even printed to the .s file.
The patch also introduces more uses of hasRawTextSupport.
The correct way to remove .mips_hack_elf_flags is to have the mips target
streamer handle the default flags (and command line options). That way the
same code path is used for asm and obj. The streamer interface should *really*
correspond to what is printed in the .s file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsAsmPrinter.cpp')
-rw-r--r-- | lib/Target/Mips/MipsAsmPrinter.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp index 24c3b61b01..2f49e74ab8 100644 --- a/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/MipsAsmPrinter.cpp @@ -108,6 +108,7 @@ void MipsAsmPrinter::EmitInstruction(const MachineInstr *MI) { return; } + MachineBasicBlock::const_instr_iterator I = MI; MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end(); @@ -633,12 +634,8 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) { } -void MipsAsmPrinter::processInitialEFlags() { - // Not having this check would work too, but would have us chew through - // code that it doesn't use for RawText. - if (OutStreamer.hasRawTextSupport()) - return; - +static void emitELFHeaderFlagsCG(MipsTargetStreamer &TargetStreamer, + const MipsSubtarget &Subtarget) { // Update e_header flags unsigned EFlags = 0; @@ -646,30 +643,30 @@ void MipsAsmPrinter::processInitialEFlags() { // Currently we assume that -mabicalls is the default. EFlags |= ELF::EF_MIPS_CPIC; - if (Subtarget->inMips16Mode()) + if (Subtarget.inMips16Mode()) EFlags |= ELF::EF_MIPS_ARCH_ASE_M16; else EFlags |= ELF::EF_MIPS_NOREORDER; // Architecture - if (Subtarget->hasMips64r2()) + if (Subtarget.hasMips64r2()) EFlags |= ELF::EF_MIPS_ARCH_64R2; - else if (Subtarget->hasMips64()) + else if (Subtarget.hasMips64()) EFlags |= ELF::EF_MIPS_ARCH_64; - else if (Subtarget->hasMips32r2()) + else if (Subtarget.hasMips32r2()) EFlags |= ELF::EF_MIPS_ARCH_32R2; else EFlags |= ELF::EF_MIPS_ARCH_32; - if (Subtarget->inMicroMipsMode()) + if (Subtarget.inMicroMipsMode()) EFlags |= ELF::EF_MIPS_MICROMIPS; // ABI - if (Subtarget->isABI_O32()) + if (Subtarget.isABI_O32()) EFlags |= ELF::EF_MIPS_ABI_O32; // Relocation Model - Reloc::Model RM = Subtarget->getRelocationModel(); + Reloc::Model RM = Subtarget.getRelocationModel(); if (RM == Reloc::PIC_ || RM == Reloc::Default) EFlags |= ELF::EF_MIPS_PIC; else if (RM == Reloc::Static) @@ -677,13 +674,14 @@ void MipsAsmPrinter::processInitialEFlags() { else llvm_unreachable("Unsupported relocation model for e_flags"); - getTargetStreamer().emitMipsELFFlags(EFlags); + TargetStreamer.emitMipsHackELFFlags(EFlags); } void MipsAsmPrinter::EmitEndOfAsmFile(Module &M) { // Emit Mips ELF register info Subtarget->getMReginfo().emitMipsReginfoSectionCG( OutStreamer, getObjFileLowering(), *Subtarget); + emitELFHeaderFlagsCG(getTargetStreamer(), *Subtarget); } void MipsAsmPrinter::PrintDebugValueComment(const MachineInstr *MI, |