xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaTargetStreamer.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1*0fca6ea1SDimitry Andric //===-- XtensaTargetStreamer.h - Xtensa Target Streamer --------*- C++ -*--===//
2*0fca6ea1SDimitry Andric //
3*0fca6ea1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0fca6ea1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0fca6ea1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0fca6ea1SDimitry Andric //
7*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
8*0fca6ea1SDimitry Andric 
9*0fca6ea1SDimitry Andric #ifndef LLVM_LIB_TARGET_XTENSA_XTENSATARGETSTREAMER_H
10*0fca6ea1SDimitry Andric #define LLVM_LIB_TARGET_XTENSA_XTENSATARGETSTREAMER_H
11*0fca6ea1SDimitry Andric 
12*0fca6ea1SDimitry Andric #include "llvm/MC/MCELFStreamer.h"
13*0fca6ea1SDimitry Andric #include "llvm/MC/MCStreamer.h"
14*0fca6ea1SDimitry Andric #include "llvm/Support/SMLoc.h"
15*0fca6ea1SDimitry Andric 
16*0fca6ea1SDimitry Andric namespace llvm {
17*0fca6ea1SDimitry Andric class formatted_raw_ostream;
18*0fca6ea1SDimitry Andric 
19*0fca6ea1SDimitry Andric class XtensaTargetStreamer : public MCTargetStreamer {
20*0fca6ea1SDimitry Andric public:
21*0fca6ea1SDimitry Andric   XtensaTargetStreamer(MCStreamer &S);
22*0fca6ea1SDimitry Andric 
23*0fca6ea1SDimitry Andric   // Emit literal label and literal Value to the literal section. If literal
24*0fca6ea1SDimitry Andric   // section is not switched yet (SwitchLiteralSection is true) then switch to
25*0fca6ea1SDimitry Andric   // literal section.
26*0fca6ea1SDimitry Andric   virtual void emitLiteral(MCSymbol *LblSym, const MCExpr *Value,
27*0fca6ea1SDimitry Andric                            bool SwitchLiteralSection, SMLoc L = SMLoc()) = 0;
28*0fca6ea1SDimitry Andric 
29*0fca6ea1SDimitry Andric   virtual void emitLiteralPosition() = 0;
30*0fca6ea1SDimitry Andric 
31*0fca6ea1SDimitry Andric   // Switch to the literal section. The BaseSection name is used to construct
32*0fca6ea1SDimitry Andric   // literal section name.
33*0fca6ea1SDimitry Andric   virtual void startLiteralSection(MCSection *BaseSection) = 0;
34*0fca6ea1SDimitry Andric };
35*0fca6ea1SDimitry Andric 
36*0fca6ea1SDimitry Andric class XtensaTargetAsmStreamer : public XtensaTargetStreamer {
37*0fca6ea1SDimitry Andric   formatted_raw_ostream &OS;
38*0fca6ea1SDimitry Andric 
39*0fca6ea1SDimitry Andric public:
40*0fca6ea1SDimitry Andric   XtensaTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
41*0fca6ea1SDimitry Andric   void emitLiteral(MCSymbol *LblSym, const MCExpr *Value,
42*0fca6ea1SDimitry Andric                    bool SwitchLiteralSection, SMLoc L) override;
43*0fca6ea1SDimitry Andric   void emitLiteralPosition() override;
44*0fca6ea1SDimitry Andric   void startLiteralSection(MCSection *Section) override;
45*0fca6ea1SDimitry Andric };
46*0fca6ea1SDimitry Andric 
47*0fca6ea1SDimitry Andric class XtensaTargetELFStreamer : public XtensaTargetStreamer {
48*0fca6ea1SDimitry Andric public:
49*0fca6ea1SDimitry Andric   XtensaTargetELFStreamer(MCStreamer &S);
50*0fca6ea1SDimitry Andric   MCELFStreamer &getStreamer();
51*0fca6ea1SDimitry Andric   void emitLiteral(MCSymbol *LblSym, const MCExpr *Value,
52*0fca6ea1SDimitry Andric                    bool SwitchLiteralSection, SMLoc L) override;
emitLiteralPosition()53*0fca6ea1SDimitry Andric   void emitLiteralPosition() override {}
54*0fca6ea1SDimitry Andric   void startLiteralSection(MCSection *Section) override;
55*0fca6ea1SDimitry Andric };
56*0fca6ea1SDimitry Andric } // end namespace llvm
57*0fca6ea1SDimitry Andric 
58*0fca6ea1SDimitry Andric #endif // LLVM_LIB_TARGET_XTENSA_XTENSATARGETSTREAMER_H
59