LLVM  8.0.1
AArch64TargetStreamer.h
Go to the documentation of this file.
1 //===-- AArch64TargetStreamer.h - AArch64 Target Streamer ------*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
11 #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
12 
13 #include "llvm/MC/MCStreamer.h"
14 
15 namespace {
16 class AArch64ELFStreamer;
17 }
18 
19 namespace llvm {
20 
22 public:
24  ~AArch64TargetStreamer() override;
25 
26  void finish() override;
27 
28  /// Callback used to implement the ldr= pseudo.
29  /// Add a new entry to the constant pool for the current section and return an
30  /// MCExpr that can be used to refer to the constant pool location.
31  const MCExpr *addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc);
32 
33  /// Callback used to implemnt the .ltorg directive.
34  /// Emit contents of constant pool for the current section.
36 
37  /// Callback used to implement the .inst directive.
38  virtual void emitInst(uint32_t Inst);
39 
40  virtual void EmitARM64WinCFIAllocStack(unsigned Size) {}
41  virtual void EmitARM64WinCFISaveFPLR(int Offset) {}
42  virtual void EmitARM64WinCFISaveFPLRX(int Offset) {}
43  virtual void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) {}
44  virtual void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) {}
45  virtual void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) {}
46  virtual void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) {}
47  virtual void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) {}
48  virtual void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) {}
49  virtual void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) {}
50  virtual void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) {}
51  virtual void EmitARM64WinCFISetFP() {}
52  virtual void EmitARM64WinCFIAddFP(unsigned Size) {}
53  virtual void EmitARM64WinCFINop() {}
54  virtual void EmitARM64WinCFIPrologEnd() {}
55  virtual void EmitARM64WinCFIEpilogStart() {}
56  virtual void EmitARM64WinCFIEpilogEnd() {}
57 
58 private:
59  std::unique_ptr<AssemblerConstantPools> ConstantPools;
60 };
61 
63 private:
64  AArch64ELFStreamer &getStreamer();
65 
66  void emitInst(uint32_t Inst) override;
67 
68 public:
70 };
71 
73 private:
74  // True if we are processing SEH directives in an epilogue.
75  bool InEpilogCFI = false;
76 
77  // Symbol of the current epilog for which we are processing SEH directives.
78  MCSymbol *CurrentEpilog = nullptr;
79 public:
81  : AArch64TargetStreamer(S) {}
82 
83  // The unwind codes on ARM64 Windows are documented at
84  // https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
85  void EmitARM64WinCFIAllocStack(unsigned Size) override;
86  void EmitARM64WinCFISaveFPLR(int Offset) override;
87  void EmitARM64WinCFISaveFPLRX(int Offset) override;
88  void EmitARM64WinCFISaveReg(unsigned Reg, int Offset) override;
89  void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset) override;
90  void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset) override;
91  void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override;
92  void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset) override;
93  void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override;
94  void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override;
95  void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override;
96  void EmitARM64WinCFISetFP() override;
97  void EmitARM64WinCFIAddFP(unsigned Size) override;
98  void EmitARM64WinCFINop() override;
99  void EmitARM64WinCFIPrologEnd() override;
100  void EmitARM64WinCFIEpilogStart() override;
101  void EmitARM64WinCFIEpilogEnd() override;
102 private:
103  void EmitARM64WinUnwindCode(unsigned UnwindCode, int Reg, int Offset);
104 };
105 
108 
109 } // end namespace llvm
110 
111 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
Target specific streamer interface.
Definition: MCStreamer.h:84
unsigned Reg
virtual void emitInst(uint32_t Inst)
Callback used to implement the .inst directive.
virtual void EmitARM64WinCFISaveRegP(unsigned Reg, int Offset)
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
virtual void EmitARM64WinCFIAddFP(unsigned Size)
const MCExpr * addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc)
Callback used to implement the ldr= pseudo.
virtual void EmitARM64WinCFIAllocStack(unsigned Size)
virtual void EmitARM64WinCFISaveFRegP(unsigned Reg, int Offset)
virtual void EmitARM64WinCFISaveFRegX(unsigned Reg, int Offset)
Streaming machine code generation interface.
Definition: MCStreamer.h:189
virtual void EmitARM64WinCFISaveFPLRX(int Offset)
AArch64TargetWinCOFFStreamer(llvm::MCStreamer &S)
MCTargetStreamer * createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
virtual void EmitARM64WinCFISaveReg(unsigned Reg, int Offset)
MCStreamer & getStreamer()
Definition: MCStreamer.h:92
virtual void EmitARM64WinCFISaveRegPX(unsigned Reg, int Offset)
virtual void EmitARM64WinCFISaveFPLR(int Offset)
virtual void EmitARM64WinCFISaveFRegPX(unsigned Reg, int Offset)
Generic base class for all target subtargets.
uint32_t Size
Definition: Profile.cpp:47
void emitCurrentConstantPool()
Callback used to implemnt the .ltorg directive.
virtual void EmitARM64WinCFISaveFReg(unsigned Reg, int Offset)
Represents a location in source code.
Definition: SMLoc.h:24
virtual void EmitARM64WinCFISaveRegX(unsigned Reg, int Offset)