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