[llvm] r200078 - This reverts commit r200064 and r200051.

Rafael Espindola rafael.espindola at gmail.com
Sat Jan 25 07:06:57 PST 2014


Author: rafael
Date: Sat Jan 25 09:06:56 2014
New Revision: 200078

URL: http://llvm.org/viewvc/llvm-project?rev=200078&view=rev
Log:
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.

Added:
    llvm/trunk/test/MC/Mips/elf_eflags.ll
    llvm/trunk/test/MC/Mips/elf_st_other.ll
      - copied, changed from r200074, llvm/trunk/test/CodeGen/Mips/elf_st_other.ll
Removed:
    llvm/trunk/test/CodeGen/Mips/elf_eflags.ll
    llvm/trunk/test/CodeGen/Mips/elf_st_other.ll
Modified:
    llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
    llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
    llvm/trunk/lib/Target/Mips/MipsAsmPrinter.h
    llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h
    llvm/trunk/test/MC/Mips/elf_eflags.s

Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Sat Jan 25 09:06:56 2014
@@ -21,9 +21,6 @@
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCTargetAsmParser.h"
-#include "llvm/Support/ELF.h"
-#include "llvm/Support/TargetRegistry.h"
-#include "llvm/ADT/APInt.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/TargetRegistry.h"
 
@@ -197,6 +194,7 @@ class MipsAsmParser : public MCTargetAsm
 
   bool isEvaluated(const MCExpr *Expr);
   bool parseDirectiveSet();
+  bool parseDirectiveMipsHackELFFlags();
   bool parseDirectiveOption();
 
   bool parseSetAtDirective();
@@ -259,9 +257,6 @@ class MipsAsmParser : public MCTargetAsm
   // Example: INSERT.B $w0[n], $1 => 16 > n >= 0
   bool validateMSAIndex(int Val, int RegKind);
 
-  // Set ELF flags based on defaults and commandline arguments.
-  void processInitialEFlags();
-
 public:
   MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,
                 const MCInstrInfo &MII)
@@ -269,7 +264,6 @@ public:
         hasConsumedDollar(false) {
     // Initialize the set of available features.
     setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
-    processInitialEFlags();
   }
 
   MCAsmParser &getParser() const { return Parser; }
@@ -2435,6 +2429,17 @@ bool MipsAsmParser::parseDirectiveSet()
   return true;
 }
 
+bool MipsAsmParser::parseDirectiveMipsHackELFFlags() {
+  int64_t Flags = 0;
+  if (Parser.parseAbsoluteExpression(Flags)) {
+    TokError("unexpected token");
+    return false;
+  }
+
+  getTargetStreamer().emitMipsHackELFFlags(Flags);
+  return false;
+}
+
 /// parseDirectiveWord
 ///  ::= .word [ expression (, expression)* ]
 bool MipsAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
@@ -2553,6 +2558,9 @@ bool MipsAsmParser::ParseDirective(AsmTo
     return false;
   }
 
+  if (IDVal == ".mips_hack_elf_flags")
+    return parseDirectiveMipsHackELFFlags();
+
   if (IDVal == ".option")
     return parseDirectiveOption();
 
@@ -2569,43 +2577,6 @@ bool MipsAsmParser::ParseDirective(AsmTo
   return true;
 }
 
-void MipsAsmParser::processInitialEFlags() {
-  // Start will a clean slate.
-  unsigned EFlags = 0;
-  unsigned FeatureBits = STI.getFeatureBits();
-
-  // Default settings
-  EFlags |= ELF::EF_MIPS_NOREORDER | ELF::EF_MIPS_PIC | ELF::EF_MIPS_ABI_O32;
-
-  // ISA
-  if (FeatureBits & Mips::FeatureMips64r2) {
-    EFlags |= ELF::EF_MIPS_ARCH_64R2;
-    EFlags &= ~ELF::EF_MIPS_ABI_O32;
-  } else if (FeatureBits & Mips::FeatureMips64) {
-    EFlags |= ELF::EF_MIPS_ARCH_64;
-    EFlags &= ~ELF::EF_MIPS_ABI_O32;
-  } else if (FeatureBits & Mips::FeatureMips32r2)
-    EFlags |= ELF::EF_MIPS_ARCH_32R2;
-  else if (FeatureBits & Mips::FeatureMips32)
-    EFlags |= ELF::EF_MIPS_ARCH_32;
-  else if (FeatureBits & Mips::FeatureO32)
-    EFlags |= ELF::EF_MIPS_ABI_O32; // This is really a zero
-
-  // ASE
-  if (FeatureBits & Mips::FeatureMicroMips)
-    EFlags |= ELF::EF_MIPS_MICROMIPS;
-  else if (FeatureBits & Mips::FeatureMips16)
-    EFlags |= ELF::EF_MIPS_ARCH_ASE_M16;
-
-  // ABI
-  // TODO: n32/eabi
-
-  // Linkage model
-  // TODO: pic/cpic/static
-
-  getTargetStreamer().emitMipsELFFlags(EFlags);
-}
-
 extern "C" void LLVMInitializeMipsAsmParser() {
   RegisterMCAsmParser<MipsAsmParser> X(TheMipsTarget);
   RegisterMCAsmParser<MipsAsmParser> Y(TheMipselTarget);

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp Sat Jan 25 09:06:56 2014
@@ -21,13 +21,23 @@
 
 using namespace llvm;
 
+static cl::opt<bool> PrintHackDirectives("print-hack-directives",
+                                         cl::init(false), cl::Hidden);
+
 // Pin vtable to this file.
 void MipsTargetStreamer::anchor() {}
 
 MipsTargetAsmStreamer::MipsTargetAsmStreamer(formatted_raw_ostream &OS)
     : OS(OS) {}
 
-void MipsTargetAsmStreamer::emitMipsELFFlags(unsigned Flags) { return; }
+void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) {
+  if (!PrintHackDirectives)
+    return;
+
+  OS << "\t.mips_hack_elf_flags 0x";
+  OS.write_hex(Flags);
+  OS << '\n';
+}
 
 void MipsTargetAsmStreamer::emitDirectiveSetMicroMips() {
   OS << "\t.set\tmicromips\n";
@@ -75,7 +85,7 @@ MCELFStreamer &MipsTargetELFStreamer::ge
   return static_cast<MCELFStreamer &>(*Streamer);
 }
 
-void MipsTargetELFStreamer::emitMipsELFFlags(unsigned Flags) {
+void MipsTargetELFStreamer::emitMipsHackELFFlags(unsigned Flags) {
   MCAssembler &MCA = getStreamer().getAssembler();
   MCA.setELFHeaderEFlags(Flags);
 }

Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Sat Jan 25 09:06:56 2014
@@ -108,6 +108,7 @@ void MipsAsmPrinter::EmitInstruction(con
     return;
   }
 
+
   MachineBasicBlock::const_instr_iterator I = MI;
   MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end();
 
@@ -633,12 +634,8 @@ void MipsAsmPrinter::EmitStartOfAsmFile(
 
 }
 
-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::processInitialEFlag
   // 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::processInitialEFlag
   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,

Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.h?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.h Sat Jan 25 09:06:56 2014
@@ -50,10 +50,6 @@ private:
   /// pool entries so we can properly mark them as data regions.
   bool InConstantPool;
 
-  // If object output, set initial eflags.
-  // This includes both default and commandline flags that affect the output
-  // ELF header flags.
-  void processInitialEFlags();
 
 public:
 
@@ -65,7 +61,6 @@ public:
     : AsmPrinter(TM, Streamer), MCP(0), InConstantPool(false),
       MCInstLowering(*this) {
     Subtarget = &TM.getSubtarget<MipsSubtarget>();
-    processInitialEFlags();
   }
 
   virtual const char *getPassName() const {
@@ -108,7 +103,6 @@ public:
   void EmitStartOfAsmFile(Module &M);
   void EmitEndOfAsmFile(Module &M);
   void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
-
 };
 }
 

Modified: llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetStreamer.h Sat Jan 25 09:06:56 2014
@@ -18,7 +18,7 @@ class MipsTargetStreamer : public MCTarg
   virtual void anchor();
 
 public:
-  virtual void emitMipsELFFlags(unsigned Flags) = 0;
+  virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
   virtual void emitDirectiveSetMicroMips() = 0;
   virtual void emitDirectiveSetNoMicroMips() = 0;
   virtual void emitDirectiveSetMips16() = 0;
@@ -34,7 +34,7 @@ class MipsTargetAsmStreamer : public Mip
 
 public:
   MipsTargetAsmStreamer(formatted_raw_ostream &OS);
-  virtual void emitMipsELFFlags(unsigned Flags);
+  virtual void emitMipsHackELFFlags(unsigned Flags);
   virtual void emitDirectiveSetMicroMips();
   virtual void emitDirectiveSetNoMicroMips();
   virtual void emitDirectiveSetMips16();
@@ -56,7 +56,7 @@ public:
   virtual void emitLabel(MCSymbol *Symbol) LLVM_OVERRIDE;
 
   // FIXME: emitMipsHackELFFlags() will be removed from this class.
-  virtual void emitMipsELFFlags(unsigned Flags);
+  virtual void emitMipsHackELFFlags(unsigned Flags);
   virtual void emitDirectiveSetMicroMips();
   virtual void emitDirectiveSetNoMicroMips();
   virtual void emitDirectiveSetMips16();

Removed: llvm/trunk/test/CodeGen/Mips/elf_eflags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/elf_eflags.ll?rev=200077&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/elf_eflags.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/elf_eflags.ll (removed)
@@ -1,121 +0,0 @@
-; This tests for directives that will result in
-; ELF EFLAGS setting with direct object.
-
-; Non-shared (static) is the absence of pic and or cpic.
-
-; EF_MIPS_NOREORDER (0x00000001) is always on by default currently
-; EF_MIPS_PIC (0x00000002)
-; EF_MIPS_CPIC (0x00000004) - See note below
-; EF_MIPS_ABI2 (0x00000020) - n32 not tested yet
-; EF_MIPS_ARCH_32 (0x50000000)
-; EF_MIPS_ARCH_64 (0x60000000)
-; EF_MIPS_ARCH_32R2 (0x70000000)
-; EF_MIPS_ARCH_64R2 (0x80000000)
-
-; Note that EF_MIPS_CPIC is set by -mabicalls which is the default on Linux
-; TODO need to support -mno-abicalls
-
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 \
-; RUN: -relocation-model=static %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32 %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32_PIC %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
-; RUN: -relocation-model=static %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32R2 %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32R2_PIC %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
-; RUN: -mattr=+micromips -relocation-model=static %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
-; RUN: -mattr=+micromips %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
-
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 \
-; RUN: -relocation-model=static %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE64 %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE64_PIC %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 \
-; RUN: -relocation-model=static %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE64R2 %s
-;
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-BE64R2_PIC %s
-
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
-; RUN: -mattr=+mips16 -relocation-model=pic %s -o - | \
-; RUN: FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
-
-; 32(R1) bit with NO_REORDER and static
-; CHECK-BE32: .abicalls
-; CHECK-BE32: .option pic0
-; CHECK-BE32: .set noreorder
-; TODO: Need .set mips32
-;
-; 32(R1) bit with NO_REORDER and PIC
-; CHECK-BE32_PIC: .abicalls
-; CHECK-BE32_PIC: .set noreorder
-; TODO: Need .set mips32 and check absence of .option pic0
-;
-; 32R2 bit with NO_REORDER and static
-; CHECK-BE32R2: .abicalls
-; CHECK-BE32R2: .option pic0
-; CHECK-BE32R2: .set noreorder
-; TODO: Need .set mips32r2
-;
-; 32R2 bit with NO_REORDER and PIC
-; CHECK-BE32R2_PIC:.abicalls
-; CHECK-BE32R2_PIC:.set noreorder
-; TODO: Need .set mips32r2 and check absence of .option pic0
-;
-; 32R2 bit MICROMIPS with NO_REORDER and static
-; CHECK-BE32R2-MICROMIPS: .abicalls
-; CHECK-BE32R2-MICROMIPS: .option pic0
-; CHECK-BE32R2-MICROMIPS: .set micromips
-; CHECK-BE32R2-MICROMIPS: .set noreorder
-; TODO: Need .set mips32r2
-;
-; 32R2 bit MICROMIPS with NO_REORDER and PIC
-; CHECK-BE32R2-MICROMIPS_PIC: .abicalls
-; CHECK-BE32R2-MICROMIPS_PIC: .set micromips
-; CHECK-BE32R2-MICROMIPS_PIC: .set noreorder
-; TODO: Need .set mips32r2 and check absence of .option pic0
-;
-; 64(R1) bit with NO_REORDER and static
-; CHECK-BE64: .abicalls
-; CHECK-BE64: .set noreorder
-; TODO: Need .set mips64 and .option pic0
-;
-; 64(R1) bit with NO_REORDER and PIC
-; CHECK-BE64_PIC: .abicalls
-; CHECK-BE64_PIC: .set noreorder
-; TODO: Need .set mips64 and check absence of .option pic0
-;
-; 64R2 bit with NO_REORDER and static
-; CHECK-BE64R2: .abicalls
-; CHECK-BE64R2: .set noreorder
-; TODO: Need .set mips64r2 and .option pic0
-;
-; 64R2 bit with NO_REORDER and PIC
-; CHECK-BE64R2_PIC: .abicalls
-; CHECK-BE64R2_PIC: .set noreorder
-; TODO: Need .set mips64r2 and check absence of .option pic0
-;
-; 32R2 bit MIPS16 with PIC
-; CHECK-LE32R2-MIPS16: .abicalls
-; CHECK-LE32R2-MIPS16: .set mips16
-; TODO: Need .set mips32r2 and check absence of .option pic0 and noreorder
-
-define i32 @main() nounwind {
-entry:
-  ret i32 0
-}

Removed: llvm/trunk/test/CodeGen/Mips/elf_st_other.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/elf_st_other.ll?rev=200077&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/elf_st_other.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/elf_st_other.ll (removed)
@@ -1,13 +0,0 @@
-; This tests value of ELF st_other field for function symbol table entries.
-; For microMIPS value should be equal to STO_MIPS_MICROMIPS.
-
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips %s \
-; RUN: -o - | FileCheck %s
-
-define i32 @main() nounwind {
-entry:
-  ret i32 0
-}
-
-; CHECK: .set micromips
-; CHECK: main:

Added: llvm/trunk/test/MC/Mips/elf_eflags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/elf_eflags.ll?rev=200078&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/elf_eflags.ll (added)
+++ llvm/trunk/test/MC/Mips/elf_eflags.ll Sat Jan 25 09:06:56 2014
@@ -0,0 +1,69 @@
+; This tests ELF EFLAGS setting with direct object.
+; When the assembler is ready a .s file for it will
+; be created.
+
+; Non-shared (static) is the absence of pic and or cpic.
+
+; EF_MIPS_NOREORDER (0x00000001) is always on by default currently
+; EF_MIPS_PIC (0x00000002)
+; EF_MIPS_CPIC (0x00000004) - See note below
+; EF_MIPS_ABI2 (0x00000020) - n32 not tested yet
+; EF_MIPS_ARCH_32 (0x50000000)
+; EF_MIPS_ARCH_64 (0x60000000)
+; EF_MIPS_ARCH_32R2 (0x70000000)
+; EF_MIPS_ARCH_64R2 (0x80000000)
+
+; Note that EF_MIPS_CPIC is set by -mabicalls which is the default on Linux
+; TODO need to support -mno-abicalls
+
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32 %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32_PIC %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32R2 %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2_PIC %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
+
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64 %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64_PIC %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2 %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2_PIC %s
+
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+mips16 -relocation-model=pic -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
+
+; 32(R1) bit with NO_REORDER and static
+; CHECK-BE32: .mips_hack_elf_flags 0x50001005
+;
+; 32(R1) bit with NO_REORDER and PIC
+; CHECK-BE32_PIC: .mips_hack_elf_flags 0x50001007
+;
+; 32R2 bit with NO_REORDER and static
+; CHECK-BE32R2: .mips_hack_elf_flags 0x70001005
+;
+; 32R2 bit with NO_REORDER and PIC
+; CHECK-BE32R2_PIC: .mips_hack_elf_flags 0x70001007
+;
+; 32R2 bit MICROMIPS with NO_REORDER and static
+; CHECK-BE32R2-MICROMIPS: .mips_hack_elf_flags 0x72001005
+;
+; 32R2 bit MICROMIPS with NO_REORDER and PIC
+; CHECK-BE32R2-MICROMIPS_PIC: .mips_hack_elf_flags 0x72001007
+;
+; 64(R1) bit with NO_REORDER and static
+; CHECK-BE64: .mips_hack_elf_flags 0x60000005
+;
+; 64(R1) bit with NO_REORDER and PIC
+; CHECK-BE64_PIC: .mips_hack_elf_flags 0x60000007
+;
+; 64R2 bit with NO_REORDER and static
+; CHECK-BE64R2: .mips_hack_elf_flags 0x80000005
+;
+; 64R2 bit with NO_REORDER and PIC
+; CHECK-BE64R2_PIC: .mips_hack_elf_flags 0x80000007
+;
+; 32R2 bit MIPS16 with PIC
+; CHECK-LE32R2-MIPS16: .mips_hack_elf_flags 0x74001006
+
+define i32 @main() nounwind {
+entry:
+  ret i32 0
+}

Modified: llvm/trunk/test/MC/Mips/elf_eflags.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/elf_eflags.s?rev=200078&r1=200077&r2=200078&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/elf_eflags.s (original)
+++ llvm/trunk/test/MC/Mips/elf_eflags.s Sat Jan 25 09:06:56 2014
@@ -1,21 +1,15 @@
-// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | \
-// RUN: llvm-readobj -h | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o -| llvm-readobj -h | FileCheck %s
+// The initial value will be set at 0x50001003 and
+// we will override that with the negation of 0x2 (option pic0
+// the addition of 0x4 (.abicalls)
 
-// From the commandline and defaults the following should be set:
-//   EF_MIPS_ARCH_32      (0x50000000)
-//   EF_MIPS_ABI_O32      (0x00001000)
-//   EF_MIPS_NOREORDER    (0x00000001)
-//   EF_MIPS_PIC          (0x00000002)
-
-// Inline directives should set or unset the following:
-//   EF_MIPS_CPIC         (0x00000004) : .abicalls
-//   EF_MIPS_ARCH_ASE_M16 (0x04000000) : .set mips16
-//   The negation of EF_MIPS_PIC : .option pic0
+        .mips_hack_elf_flags 0x50001003
 
 // CHECK: Flags [ (0x54001005)
 
         .abicalls
 
         .option pic0
-
+ 
+ // Set EF_MIPS_ARCH_ASE_M16 (0x04000000)
         .set mips16

Copied: llvm/trunk/test/MC/Mips/elf_st_other.ll (from r200074, llvm/trunk/test/CodeGen/Mips/elf_st_other.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/elf_st_other.ll?p2=llvm/trunk/test/MC/Mips/elf_st_other.ll&p1=llvm/trunk/test/CodeGen/Mips/elf_st_other.ll&r1=200074&r2=200078&rev=200078&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/elf_st_other.ll (original)
+++ llvm/trunk/test/MC/Mips/elf_st_other.ll Sat Jan 25 09:06:56 2014
@@ -1,13 +1,12 @@
 ; This tests value of ELF st_other field for function symbol table entries.
 ; For microMIPS value should be equal to STO_MIPS_MICROMIPS.
 
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips %s \
-; RUN: -o - | FileCheck %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck %s
 
 define i32 @main() nounwind {
 entry:
   ret i32 0
 }
 
-; CHECK: .set micromips
+; CHECK: .set	micromips
 ; CHECK: main:





More information about the llvm-commits mailing list