[X86][BMI] Pull out schedule classes from bmi_andn<> and bmi_bls<>
[llvm-core.git] / lib / Target / AArch64 / MCTargetDesc / AArch64TargetStreamer.h
blob3a0c5d8318dd5feeb1fd6b76849d7a84282039dc
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
10 #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
12 #include "llvm/MC/MCStreamer.h"
14 namespace {
15 class AArch64ELFStreamer;
18 namespace llvm {
20 class AArch64TargetStreamer : public MCTargetStreamer {
21 public:
22 AArch64TargetStreamer(MCStreamer &S);
23 ~AArch64TargetStreamer() override;
25 void finish() override;
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);
32 /// Callback used to implemnt the .ltorg directive.
33 /// Emit contents of constant pool for the current section.
34 void emitCurrentConstantPool();
36 /// Callback used to implement the .inst directive.
37 virtual void emitInst(uint32_t Inst);
39 virtual void EmitARM64WinCFIAllocStack(unsigned Size) {}
40 virtual void EmitARM64WinCFISaveFPLR(int Offset) {}
41 virtual void EmitARM64WinCFISaveFPLRX(int Offset) {}
42 virtual void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) {}
43 virtual void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) {}
44 virtual void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) {}
45 virtual void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) {}
46 virtual void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) {}
47 virtual void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) {}
48 virtual void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) {}
49 virtual void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) {}
50 virtual void EmitARM64WinCFISetFP() {}
51 virtual void EmitARM64WinCFIAddFP(unsigned Size) {}
52 virtual void EmitARM64WinCFINop() {}
53 virtual void EmitARM64WinCFIPrologEnd() {}
54 virtual void EmitARM64WinCFIEpilogStart() {}
55 virtual void EmitARM64WinCFIEpilogEnd() {}
57 private:
58 std::unique_ptr<AssemblerConstantPools> ConstantPools;
61 class AArch64TargetELFStreamer : public AArch64TargetStreamer {
62 private:
63 AArch64ELFStreamer &getStreamer();
65 void emitInst(uint32_t Inst) override;
67 public:
68 AArch64TargetELFStreamer(MCStreamer &S) : AArch64TargetStreamer(S) {}
71 class AArch64TargetWinCOFFStreamer : public llvm::AArch64TargetStreamer {
72 private:
73 // True if we are processing SEH directives in an epilogue.
74 bool InEpilogCFI = false;
76 // Symbol of the current epilog for which we are processing SEH directives.
77 MCSymbol *CurrentEpilog = nullptr;
78 public:
79 AArch64TargetWinCOFFStreamer(llvm::MCStreamer &S)
80 : AArch64TargetStreamer(S) {}
82 // The unwind codes on ARM64 Windows are documented at
83 // https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
84 void EmitARM64WinCFIAllocStack(unsigned Size) override;
85 void EmitARM64WinCFISaveFPLR(int Offset) override;
86 void EmitARM64WinCFISaveFPLRX(int Offset) override;
87 void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) override;
88 void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) override;
89 void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) override;
90 void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override;
91 void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) override;
92 void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override;
93 void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override;
94 void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override;
95 void EmitARM64WinCFISetFP() override;
96 void EmitARM64WinCFIAddFP(unsigned Size) override;
97 void EmitARM64WinCFINop() override;
98 void EmitARM64WinCFIPrologEnd() override;
99 void EmitARM64WinCFIEpilogStart() override;
100 void EmitARM64WinCFIEpilogEnd() override;
101 private:
102 void EmitARM64WinUnwindCode(unsigned UnwindCode, int Reg, int Offset);
105 MCTargetStreamer *
106 createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
108 } // end namespace llvm
110 #endif