LLVM  13.0.0git
AArch64TargetStreamer.h
Go to the documentation of this file.
1 //===-- AArch64TargetStreamer.h - AArch64 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_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
10 #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
11 
12 #include "llvm/MC/MCStreamer.h"
13 
14 namespace {
15 class AArch64ELFStreamer;
16 }
17 
18 namespace llvm {
19 
21 public:
23  ~AArch64TargetStreamer() override;
24 
25  void finish() override;
26 
27  /// Callback used to implement the ldr= pseudo.
28  /// Add a new entry to the constant pool for the current section and return an
29  /// MCExpr that can be used to refer to the constant pool location.
30  const MCExpr *addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc);
31 
32  /// Callback used to implemnt the .ltorg directive.
33  /// Emit contents of constant pool for the current section.
35 
36  /// Callback used to implement the .note.gnu.property section.
37  void emitNoteSection(unsigned Flags);
38 
39  /// Callback used to implement the .inst directive.
40  virtual void emitInst(uint32_t Inst);
41 
42  /// Callback used to implement the .variant_pcs directive.
44 
45  virtual void EmitARM64WinCFIAllocStack(unsigned Size) {}
46  virtual void EmitARM64WinCFISaveR19R20X(int Offset) {}
47  virtual void EmitARM64WinCFISaveFPLR(int Offset) {}
48  virtual void EmitARM64WinCFISaveFPLRX(int Offset) {}
49  virtual void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) {}
50  virtual void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) {}
51  virtual void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) {}
52  virtual void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) {}
53  virtual void EmitARM64WinCFISaveLRPair(unsigned Reg, int Offset) {}
54  virtual void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) {}
55  virtual void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) {}
56  virtual void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) {}
57  virtual void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) {}
58  virtual void EmitARM64WinCFISetFP() {}
59  virtual void EmitARM64WinCFIAddFP(unsigned Size) {}
60  virtual void EmitARM64WinCFINop() {}
61  virtual void EmitARM64WinCFISaveNext() {}
62  virtual void EmitARM64WinCFIPrologEnd() {}
63  virtual void EmitARM64WinCFIEpilogStart() {}
64  virtual void EmitARM64WinCFIEpilogEnd() {}
65  virtual void EmitARM64WinCFITrapFrame() {}
66  virtual void EmitARM64WinCFIMachineFrame() {}
67  virtual void EmitARM64WinCFIContext() {}
69 
70 private:
71  std::unique_ptr<AssemblerConstantPools> ConstantPools;
72 };
73 
75 private:
76  AArch64ELFStreamer &getStreamer();
77 
78  void emitInst(uint32_t Inst) override;
79  void emitDirectiveVariantPCS(MCSymbol *Symbol) override;
80 
81 public:
83 };
84 
86 private:
87  // True if we are processing SEH directives in an epilogue.
88  bool InEpilogCFI = false;
89 
90  // Symbol of the current epilog for which we are processing SEH directives.
91  MCSymbol *CurrentEpilog = nullptr;
92 public:
95 
96  // The unwind codes on ARM64 Windows are documented at
97  // https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
98  void EmitARM64WinCFIAllocStack(unsigned Size) override;
99  void EmitARM64WinCFISaveR19R20X(int Offset) override;
100  void EmitARM64WinCFISaveFPLR(int Offset) override;
101  void EmitARM64WinCFISaveFPLRX(int Offset) override;
102  void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) override;
103  void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) override;
104  void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) override;
105  void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override;
106  void EmitARM64WinCFISaveLRPair(unsigned Reg, int Offset) override;
107  void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) override;
108  void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override;
109  void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override;
110  void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override;
111  void EmitARM64WinCFISetFP() override;
112  void EmitARM64WinCFIAddFP(unsigned Size) override;
113  void EmitARM64WinCFINop() override;
114  void EmitARM64WinCFISaveNext() override;
115  void EmitARM64WinCFIPrologEnd() override;
116  void EmitARM64WinCFIEpilogStart() override;
117  void EmitARM64WinCFIEpilogEnd() override;
118  void EmitARM64WinCFITrapFrame() override;
119  void EmitARM64WinCFIMachineFrame() override;
120  void EmitARM64WinCFIContext() override;
121  void EmitARM64WinCFIClearUnwoundToCall() override;
122 
123 private:
124  void EmitARM64WinUnwindCode(unsigned UnwindCode, int Reg, int Offset);
125 };
126 
127 MCTargetStreamer *
128 createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
129 
130 } // end namespace llvm
131 
132 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIEpilogStart
void EmitARM64WinCFIEpilogStart() override
Definition: AArch64WinCOFFStreamer.cpp:185
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveR19R20X
virtual void EmitARM64WinCFISaveR19R20X(int Offset)
Definition: AArch64TargetStreamer.h:46
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveRegPX
void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:121
llvm::AArch64TargetStreamer::emitNoteSection
void emitNoteSection(unsigned Flags)
Callback used to implement the .note.gnu.property section.
Definition: AArch64TargetStreamer.cpp:60
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIPrologEnd
void EmitARM64WinCFIPrologEnd() override
Definition: AArch64WinCOFFStreamer.cpp:172
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISetFP
void EmitARM64WinCFISetFP() override
Definition: AArch64WinCOFFStreamer.cpp:153
llvm::AArch64TargetStreamer::emitInst
virtual void emitInst(uint32_t Inst)
Callback used to implement the .inst directive.
Definition: AArch64TargetStreamer.cpp:96
llvm::AArch64TargetStreamer::EmitARM64WinCFIMachineFrame
virtual void EmitARM64WinCFIMachineFrame()
Definition: AArch64TargetStreamer.h:66
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFINop
void EmitARM64WinCFINop() override
Definition: AArch64WinCOFFStreamer.cpp:162
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::AArch64TargetStreamer::EmitARM64WinCFIEpilogEnd
virtual void EmitARM64WinCFIEpilogEnd()
Definition: AArch64TargetStreamer.h:64
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFRegX
void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:138
llvm::createAArch64ObjectTargetStreamer
MCTargetStreamer * createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: AArch64TargetStreamer.cpp:111
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIAllocStack
void EmitARM64WinCFIAllocStack(unsigned Size) override
Definition: AArch64WinCOFFStreamer.cpp:83
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIContext
void EmitARM64WinCFIContext() override
Definition: AArch64WinCOFFStreamer.cpp:216
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
llvm::AArch64TargetStreamer::AArch64TargetStreamer
AArch64TargetStreamer(MCStreamer &S)
Definition: AArch64TargetStreamer.cpp:34
llvm::AArch64TargetStreamer::EmitARM64WinCFIContext
virtual void EmitARM64WinCFIContext()
Definition: AArch64TargetStreamer.h:67
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFRegPX
virtual void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:57
llvm::AArch64TargetELFStreamer::AArch64TargetELFStreamer
AArch64TargetELFStreamer(MCStreamer &S)
Definition: AArch64TargetStreamer.h:82
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::AArch64TargetStreamer::EmitARM64WinCFISetFP
virtual void EmitARM64WinCFISetFP()
Definition: AArch64TargetStreamer.h:58
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFPLR
void EmitARM64WinCFISaveFPLR(int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:96
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFRegP
virtual void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:56
llvm::AArch64TargetStreamer::EmitARM64WinCFIClearUnwoundToCall
virtual void EmitARM64WinCFIClearUnwoundToCall()
Definition: AArch64TargetStreamer.h:68
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveRegX
virtual void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:50
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:91
llvm::AArch64TargetELFStreamer
Definition: AArch64TargetStreamer.h:74
llvm::AArch64TargetStreamer::emitDirectiveVariantPCS
virtual void emitDirectiveVariantPCS(MCSymbol *Symbol)
Callback used to implement the .variant_pcs directive.
Definition: AArch64TargetStreamer.h:43
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFPLR
virtual void EmitARM64WinCFISaveFPLR(int Offset)
Definition: AArch64TargetStreamer.h:47
llvm::AArch64TargetStreamer::EmitARM64WinCFIEpilogStart
virtual void EmitARM64WinCFIEpilogStart()
Definition: AArch64TargetStreamer.h:63
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFReg
virtual void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:54
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIClearUnwoundToCall
void EmitARM64WinCFIClearUnwoundToCall() override
Definition: AArch64WinCOFFStreamer.cpp:220
llvm::AArch64TargetWinCOFFStreamer
Definition: AArch64TargetStreamer.h:85
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFRegP
void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:143
llvm::AArch64TargetStreamer
Definition: AArch64TargetStreamer.h:20
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFRegPX
void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:148
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFPLRX
virtual void EmitARM64WinCFISaveFPLRX(int Offset)
Definition: AArch64TargetStreamer.h:48
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFPLRX
void EmitARM64WinCFISaveFPLRX(int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:100
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveNext
virtual void EmitARM64WinCFISaveNext()
Definition: AArch64TargetStreamer.h:61
llvm::AArch64TargetStreamer::~AArch64TargetStreamer
~AArch64TargetStreamer() override
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveReg
virtual void EmitARM64WinCFISaveReg(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:49
llvm::AArch64TargetStreamer::finish
void finish() override
Definition: AArch64TargetStreamer.cpp:53
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveR19R20X
void EmitARM64WinCFISaveR19R20X(int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:92
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIMachineFrame
void EmitARM64WinCFIMachineFrame() override
Definition: AArch64WinCOFFStreamer.cpp:212
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIAddFP
void EmitARM64WinCFIAddFP(unsigned Size) override
Definition: AArch64WinCOFFStreamer.cpp:157
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFIEpilogEnd
void EmitARM64WinCFIEpilogEnd() override
Definition: AArch64WinCOFFStreamer.cpp:195
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveLRPair
virtual void EmitARM64WinCFISaveLRPair(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:53
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveLRPair
void EmitARM64WinCFISaveLRPair(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:126
llvm::AArch64TargetStreamer::EmitARM64WinCFIPrologEnd
virtual void EmitARM64WinCFIPrologEnd()
Definition: AArch64TargetStreamer.h:62
llvm::AArch64TargetStreamer::EmitARM64WinCFIAllocStack
virtual void EmitARM64WinCFIAllocStack(unsigned Size)
Definition: AArch64TargetStreamer.h:45
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveFReg
void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:131
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveNext
void EmitARM64WinCFISaveNext() override
Definition: AArch64WinCOFFStreamer.cpp:166
llvm::AArch64TargetStreamer::EmitARM64WinCFIAddFP
virtual void EmitARM64WinCFIAddFP(unsigned Size)
Definition: AArch64TargetStreamer.h:59
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:79
llvm::AArch64TargetStreamer::addConstantPoolEntry
const MCExpr * addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc)
Callback used to implement the ldr= pseudo.
Definition: AArch64TargetStreamer.cpp:41
llvm::AArch64TargetStreamer::EmitARM64WinCFITrapFrame
virtual void EmitARM64WinCFITrapFrame()
Definition: AArch64TargetStreamer.h:65
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveFRegX
virtual void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:55
llvm::AArch64TargetStreamer::EmitARM64WinCFINop
virtual void EmitARM64WinCFINop()
Definition: AArch64TargetStreamer.h:60
llvm::AArch64TargetWinCOFFStreamer::AArch64TargetWinCOFFStreamer
AArch64TargetWinCOFFStreamer(llvm::MCStreamer &S)
Definition: AArch64TargetStreamer.h:93
MCStreamer.h
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveRegP
void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:116
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveRegX
void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:111
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveRegP
virtual void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:51
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFITrapFrame
void EmitARM64WinCFITrapFrame() override
Definition: AArch64WinCOFFStreamer.cpp:208
llvm::AArch64TargetWinCOFFStreamer::EmitARM64WinCFISaveReg
void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) override
Definition: AArch64WinCOFFStreamer.cpp:104
llvm::AArch64TargetStreamer::EmitARM64WinCFISaveRegPX
virtual void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset)
Definition: AArch64TargetStreamer.h:52
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::AArch64TargetStreamer::emitCurrentConstantPool
void emitCurrentConstantPool()
Callback used to implemnt the .ltorg directive.
Definition: AArch64TargetStreamer.cpp:47