LLVM 20.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 "AArch64MCExpr.h"
13#include "llvm/MC/MCStreamer.h"
14
15namespace {
16class AArch64ELFStreamer;
17}
18
19namespace llvm {
20
22public:
25
26 void finish() override;
27 void emitConstantPools() override;
28
29 /// Callback used to implement the ldr= pseudo.
30 /// Add a new entry to the constant pool for the current section and return an
31 /// MCExpr that can be used to refer to the constant pool location.
32 const MCExpr *addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc);
33
34 /// Callback used to implement the .ltorg directive.
35 /// Emit contents of constant pool for the current section.
37
38 /// Callback used to implement the .note.gnu.property section.
39 void emitNoteSection(unsigned Flags, uint64_t PAuthABIPlatform = -1,
40 uint64_t PAuthABIVersion = -1);
41
42 /// Callback used to emit AUTH expressions (e.g. signed
43 /// personality function pointer).
44 void emitAuthValue(const MCExpr *Expr, uint16_t Discriminator,
45 AArch64PACKey::ID Key, bool HasAddressDiversity);
46
47 /// Callback used to implement the .inst directive.
48 virtual void emitInst(uint32_t Inst);
49
50 /// Callback used to implement the .variant_pcs directive.
51 virtual void emitDirectiveVariantPCS(MCSymbol *Symbol) {};
52
53 virtual void emitARM64WinCFIAllocStack(unsigned Size) {}
55 virtual void emitARM64WinCFISaveFPLR(int Offset) {}
56 virtual void emitARM64WinCFISaveFPLRX(int Offset) {}
57 virtual void emitARM64WinCFISaveReg(unsigned Reg, int Offset) {}
58 virtual void emitARM64WinCFISaveRegX(unsigned Reg, int Offset) {}
59 virtual void emitARM64WinCFISaveRegP(unsigned Reg, int Offset) {}
60 virtual void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset) {}
61 virtual void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset) {}
62 virtual void emitARM64WinCFISaveFReg(unsigned Reg, int Offset) {}
63 virtual void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset) {}
64 virtual void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset) {}
65 virtual void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) {}
66 virtual void emitARM64WinCFISetFP() {}
67 virtual void emitARM64WinCFIAddFP(unsigned Size) {}
68 virtual void emitARM64WinCFINop() {}
69 virtual void emitARM64WinCFISaveNext() {}
70 virtual void emitARM64WinCFIPrologEnd() {}
72 virtual void emitARM64WinCFIEpilogEnd() {}
73 virtual void emitARM64WinCFITrapFrame() {}
75 virtual void emitARM64WinCFIContext() {}
76 virtual void emitARM64WinCFIECContext() {}
78 virtual void emitARM64WinCFIPACSignLR() {}
79 virtual void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset) {}
80 virtual void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset) {}
81 virtual void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset) {}
82 virtual void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset) {}
83 virtual void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset) {}
84 virtual void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset) {}
85 virtual void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset) {}
86 virtual void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset) {}
87 virtual void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset) {}
88 virtual void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset) {}
89 virtual void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset) {}
90 virtual void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset) {}
91
92private:
93 std::unique_ptr<AssemblerConstantPools> ConstantPools;
94};
95
97private:
98 AArch64ELFStreamer &getStreamer();
99
100 void emitInst(uint32_t Inst) override;
101 void emitDirectiveVariantPCS(MCSymbol *Symbol) override;
102 void finish() override;
103
104public:
106};
107
109private:
110 // True if we are processing SEH directives in an epilogue.
111 bool InEpilogCFI = false;
112
113 // Symbol of the current epilog for which we are processing SEH directives.
114 MCSymbol *CurrentEpilog = nullptr;
115public:
118
119 // The unwind codes on ARM64 Windows are documented at
120 // https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
121 void emitARM64WinCFIAllocStack(unsigned Size) override;
122 void emitARM64WinCFISaveR19R20X(int Offset) override;
123 void emitARM64WinCFISaveFPLR(int Offset) override;
124 void emitARM64WinCFISaveFPLRX(int Offset) override;
125 void emitARM64WinCFISaveReg(unsigned Reg, int Offset) override;
126 void emitARM64WinCFISaveRegX(unsigned Reg, int Offset) override;
127 void emitARM64WinCFISaveRegP(unsigned Reg, int Offset) override;
128 void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override;
129 void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset) override;
130 void emitARM64WinCFISaveFReg(unsigned Reg, int Offset) override;
131 void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override;
132 void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override;
133 void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override;
134 void emitARM64WinCFISetFP() override;
135 void emitARM64WinCFIAddFP(unsigned Size) override;
136 void emitARM64WinCFINop() override;
137 void emitARM64WinCFISaveNext() override;
138 void emitARM64WinCFIPrologEnd() override;
139 void emitARM64WinCFIEpilogStart() override;
140 void emitARM64WinCFIEpilogEnd() override;
141 void emitARM64WinCFITrapFrame() override;
142 void emitARM64WinCFIMachineFrame() override;
143 void emitARM64WinCFIContext() override;
144 void emitARM64WinCFIECContext() override;
145 void emitARM64WinCFIClearUnwoundToCall() override;
146 void emitARM64WinCFIPACSignLR() override;
147 void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset) override;
148 void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset) override;
149 void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset) override;
150 void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset) override;
151 void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset) override;
152 void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset) override;
153 void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset) override;
154 void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset) override;
155 void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset) override;
156 void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset) override;
157 void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset) override;
158 void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset) override;
159
160private:
161 void emitARM64WinUnwindCode(unsigned UnwindCode, int Reg, int Offset);
162};
163
164MCTargetStreamer *
165createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
166
167MCTargetStreamer *createAArch64NullTargetStreamer(MCStreamer &S);
168
169} // end namespace llvm
170
171#endif
uint64_t Size
unsigned Reg
virtual void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFReg(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegX(unsigned Reg, int Offset)
virtual void emitARM64WinCFIAllocStack(unsigned Size)
virtual void emitARM64WinCFISaveFPLRX(int Offset)
const MCExpr * addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc)
Callback used to implement the ldr= pseudo.
virtual void emitDirectiveVariantPCS(MCSymbol *Symbol)
Callback used to implement the .variant_pcs directive.
virtual void emitARM64WinCFISaveR19R20X(int Offset)
virtual void emitARM64WinCFIAddFP(unsigned Size)
virtual void emitARM64WinCFISaveFPLR(int Offset)
virtual void emitARM64WinCFIClearUnwoundToCall()
virtual void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset)
void emitNoteSection(unsigned Flags, uint64_t PAuthABIPlatform=-1, uint64_t PAuthABIVersion=-1)
Callback used to implement the .note.gnu.property section.
virtual void emitARM64WinCFISaveReg(unsigned Reg, int Offset)
void emitAuthValue(const MCExpr *Expr, uint16_t Discriminator, AArch64PACKey::ID Key, bool HasAddressDiversity)
Callback used to emit AUTH expressions (e.g.
virtual void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset)
void emitCurrentConstantPool()
Callback used to implement the .ltorg directive.
virtual void emitInst(uint32_t Inst)
Callback used to implement the .inst directive.
virtual void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset)
void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset) override
void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override
void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveRegP(unsigned Reg, int Offset) override
void emitARM64WinCFISaveR19R20X(int Offset) override
void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveRegX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveFPLR(int Offset) override
void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override
AArch64TargetWinCOFFStreamer(llvm::MCStreamer &S)
void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset) override
void emitARM64WinCFIAllocStack(unsigned Size) override
void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset) override
void emitARM64WinCFISaveFReg(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset) override
void emitARM64WinCFISaveFPLRX(int Offset) override
void emitARM64WinCFISaveReg(unsigned Reg, int Offset) override
void emitARM64WinCFIAddFP(unsigned Size) override
void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset) override
void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset) override
void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset) override
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Streaming machine code generation interface.
Definition: MCStreamer.h:213
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Target specific streamer interface.
Definition: MCStreamer.h:94
Represents a location in source code.
Definition: SMLoc.h:23
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
MCTargetStreamer * createAArch64NullTargetStreamer(MCStreamer &S)
MCTargetStreamer * createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)