summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-05 16:42:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-05 16:42:21 +0000
commit5e195a4c8d8cd4498ab7e0aa16a3b6f273daf457 (patch)
treef1a16cd335e72328c783313d879489675631f69d /include
parent5ccfef6a1d9a5d3fcea56d8900dd35931c793484 (diff)
downloadllvm-5e195a4c8d8cd4498ab7e0aa16a3b6f273daf457.tar.gz
llvm-5e195a4c8d8cd4498ab7e0aa16a3b6f273daf457.tar.bz2
llvm-5e195a4c8d8cd4498ab7e0aa16a3b6f273daf457.tar.xz
Remove some really nasty uses of hasRawTextSupport.
When MC was first added, targets could use hasRawTextSupport to keep features working before they were added to the MC interface. The design goal of MC is to provide an uniform api for printing assembly and object files. Short of relaxations and other corner cases, a object file is just another representation of the assembly. It was never the intention that targets would keep doing things like if (hasRawTextSupport()) Set flags in one way. else Set flags in another way. When they do that they create two code paths and the object file is no longer just another representation of the assembly. This also then requires testing with llc -filetype=obj, which is extremelly brittle. This patch removes some of these hacks by replacing them with smaller ones. The ARM flag setting is trivial, so I just moved it to the constructor. For Mips, the patch adds two temporary hack directives that allow the assembly to represent the same things as the object file was already able to. The hope is that the mips developers will replace the hack directives with the same ones that gas uses and drop the -print-hack-directives flag. I will also try to implement a target streamer interface, so that we can move this out of the common code. In summary, for any new work, two rules of the thumb are * Don't use "llc -filetype=obj" in tests. * Don't add calls to hasRawTextSupport. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCELFStreamer.h24
-rw-r--r--include/llvm/MC/MCObjectStreamer.h15
-rw-r--r--include/llvm/MC/MCStreamer.h25
3 files changed, 20 insertions, 44 deletions
diff --git a/include/llvm/MC/MCELFStreamer.h b/include/llvm/MC/MCELFStreamer.h
index 76369ccb23..0f45a93f95 100644
--- a/include/llvm/MC/MCELFStreamer.h
+++ b/include/llvm/MC/MCELFStreamer.h
@@ -28,20 +28,14 @@ class MCSymbolData;
class raw_ostream;
class MCELFStreamer : public MCObjectStreamer {
-protected:
- MCELFStreamer(StreamerKind Kind, MCContext &Context, MCAsmBackend &TAB,
- raw_ostream &OS, MCCodeEmitter *Emitter)
- : MCObjectStreamer(Kind, Context, TAB, OS, Emitter) {}
-
public:
MCELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
MCCodeEmitter *Emitter)
- : MCObjectStreamer(SK_ELFStreamer, Context, TAB, OS, Emitter) {}
+ : MCObjectStreamer(Context, TAB, OS, Emitter) {}
MCELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
MCCodeEmitter *Emitter, MCAssembler *Assembler)
- : MCObjectStreamer(SK_ELFStreamer, Context, TAB, OS, Emitter,
- Assembler) {}
+ : MCObjectStreamer(Context, TAB, OS, Emitter, Assembler) {}
virtual ~MCELFStreamer();
@@ -88,11 +82,6 @@ public:
virtual void Flush();
virtual void FinishImpl();
- /// @}
-
- static bool classof(const MCStreamer *S) {
- return S->getKind() == SK_ELFStreamer || S->getKind() == SK_ARMELFStreamer;
- }
private:
virtual void EmitInstToFragment(const MCInst &Inst);
@@ -122,6 +111,15 @@ private:
void SetSectionBss();
};
+MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
+ raw_ostream &OS, MCCodeEmitter *Emitter,
+ bool RelaxAll, bool NoExecStack);
+
+MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
+ raw_ostream &OS, MCCodeEmitter *Emitter,
+ bool RelaxAll, bool NoExecStack,
+ bool IsThumb);
+
} // end namespace llvm
#endif
diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h
index 0affeee08c..f6a7e713c4 100644
--- a/include/llvm/MC/MCObjectStreamer.h
+++ b/include/llvm/MC/MCObjectStreamer.h
@@ -40,11 +40,10 @@ class MCObjectStreamer : public MCStreamer {
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
protected:
- MCObjectStreamer(StreamerKind Kind, MCContext &Context, MCAsmBackend &TAB,
- raw_ostream &_OS, MCCodeEmitter *_Emitter);
- MCObjectStreamer(StreamerKind Kind, MCContext &Context, MCAsmBackend &TAB,
- raw_ostream &_OS, MCCodeEmitter *_Emitter,
- MCAssembler *_Assembler);
+ MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS,
+ MCCodeEmitter *_Emitter);
+ MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS,
+ MCCodeEmitter *_Emitter, MCAssembler *_Assembler);
~MCObjectStreamer();
public:
@@ -116,12 +115,6 @@ public:
virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
virtual void EmitZeros(uint64_t NumBytes);
virtual void FinishImpl();
-
- /// @}
-
- static bool classof(const MCStreamer *S) {
- return S->getKind() >= SK_ELFStreamer && S->getKind() <= SK_WinCOFFStreamer;
- }
};
} // end namespace llvm
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index a5f8bc05bc..3cd5c773c1 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -49,23 +49,6 @@ typedef std::pair<const MCSection *, const MCExpr *> MCSectionSubPair;
/// a .s file, and implementations that write out .o files of various formats.
///
class MCStreamer {
-public:
- enum StreamerKind {
- SK_AsmStreamer,
- SK_NullStreamer,
- SK_RecordStreamer,
-
- // MCObjectStreamer subclasses.
- SK_ELFStreamer,
- SK_ARMELFStreamer,
- SK_MachOStreamer,
- SK_PureStreamer,
- SK_MipsELFStreamer,
- SK_WinCOFFStreamer
- };
-
-private:
- const StreamerKind Kind;
MCContext &Context;
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
@@ -97,7 +80,7 @@ private:
bool AutoInitSections;
protected:
- MCStreamer(StreamerKind Kind, MCContext &Ctx);
+ MCStreamer(MCContext &Ctx);
const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
const MCSymbol *B);
@@ -118,8 +101,6 @@ protected:
public:
virtual ~MCStreamer();
- StreamerKind getKind() const { return Kind; }
-
/// State management
///
virtual void reset();
@@ -632,6 +613,10 @@ public:
virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
bool isVector);
+ /// Mips-related methods.
+ virtual void emitMipsHackELFFlags(unsigned Flags);
+ virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
+
/// PPC-related methods.
/// FIXME: Eventually replace it with some "target MC streamer" and move
/// these methods there.