Taints the non-acquire RMW's store address with the load part
[oota-llvm.git] / lib / Target / AArch64 / InstPrinter / AArch64InstPrinter.h
1 //===-- AArch64InstPrinter.h - Convert AArch64 MCInst to assembly syntax --===//
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 // This class prints an AArch64 MCInst to a .s file.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_AARCH64_INSTPRINTER_AARCH64INSTPRINTER_H
15 #define LLVM_LIB_TARGET_AARCH64_INSTPRINTER_AARCH64INSTPRINTER_H
16
17 #include "MCTargetDesc/AArch64MCTargetDesc.h"
18 #include "llvm/MC/MCInstPrinter.h"
19
20 namespace llvm {
21
22 class AArch64InstPrinter : public MCInstPrinter {
23 public:
24   AArch64InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
25                      const MCRegisterInfo &MRI);
26
27   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
28                  const MCSubtargetInfo &STI) override;
29   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
30
31   // Autogenerated by tblgen.
32   virtual void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
33                                 raw_ostream &O);
34   virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
35                                raw_ostream &O);
36   virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
37                                        unsigned PrintMethodIdx,
38                                        const MCSubtargetInfo &STI,
39                                        raw_ostream &O);
40   virtual StringRef getRegName(unsigned RegNo) const {
41     return getRegisterName(RegNo);
42   }
43   static const char *getRegisterName(unsigned RegNo,
44                                      unsigned AltIdx = AArch64::NoRegAltName);
45
46 protected:
47   bool printSysAlias(const MCInst *MI, const MCSubtargetInfo &STI,
48                      raw_ostream &O);
49   // Operand printers
50   void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
51                     raw_ostream &O);
52   void printHexImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
53                    raw_ostream &O);
54   void printPostIncOperand(const MCInst *MI, unsigned OpNo, unsigned Imm,
55                            raw_ostream &O);
56   template <int Amount>
57   void printPostIncOperand(const MCInst *MI, unsigned OpNo,
58                            const MCSubtargetInfo &STI, raw_ostream &O) {
59     printPostIncOperand(MI, OpNo, Amount, O);
60   }
61
62   void printVRegOperand(const MCInst *MI, unsigned OpNo,
63                         const MCSubtargetInfo &STI, raw_ostream &O);
64   void printSysCROperand(const MCInst *MI, unsigned OpNo,
65                          const MCSubtargetInfo &STI, raw_ostream &O);
66   void printAddSubImm(const MCInst *MI, unsigned OpNum,
67                       const MCSubtargetInfo &STI, raw_ostream &O);
68   void printLogicalImm32(const MCInst *MI, unsigned OpNum,
69                          const MCSubtargetInfo &STI, raw_ostream &O);
70   void printLogicalImm64(const MCInst *MI, unsigned OpNum,
71                          const MCSubtargetInfo &STI, raw_ostream &O);
72   void printShifter(const MCInst *MI, unsigned OpNum,
73                     const MCSubtargetInfo &STI, raw_ostream &O);
74   void printShiftedRegister(const MCInst *MI, unsigned OpNum,
75                             const MCSubtargetInfo &STI, raw_ostream &O);
76   void printExtendedRegister(const MCInst *MI, unsigned OpNum,
77                              const MCSubtargetInfo &STI, raw_ostream &O);
78   void printArithExtend(const MCInst *MI, unsigned OpNum,
79                         const MCSubtargetInfo &STI, raw_ostream &O);
80
81   void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O,
82                       char SrcRegKind, unsigned Width);
83   template <char SrcRegKind, unsigned Width>
84   void printMemExtend(const MCInst *MI, unsigned OpNum,
85                       const MCSubtargetInfo &STI, raw_ostream &O) {
86     printMemExtend(MI, OpNum, O, SrcRegKind, Width);
87   }
88
89   void printCondCode(const MCInst *MI, unsigned OpNum,
90                      const MCSubtargetInfo &STI, raw_ostream &O);
91   void printInverseCondCode(const MCInst *MI, unsigned OpNum,
92                             const MCSubtargetInfo &STI, raw_ostream &O);
93   void printAlignedLabel(const MCInst *MI, unsigned OpNum,
94                          const MCSubtargetInfo &STI, raw_ostream &O);
95   void printUImm12Offset(const MCInst *MI, unsigned OpNum, unsigned Scale,
96                          raw_ostream &O);
97   void printAMIndexedWB(const MCInst *MI, unsigned OpNum, unsigned Scale,
98                         raw_ostream &O);
99
100   template <int Scale>
101   void printUImm12Offset(const MCInst *MI, unsigned OpNum,
102                          const MCSubtargetInfo &STI, raw_ostream &O) {
103     printUImm12Offset(MI, OpNum, Scale, O);
104   }
105
106   template <int BitWidth>
107   void printAMIndexedWB(const MCInst *MI, unsigned OpNum,
108                         const MCSubtargetInfo &STI, raw_ostream &O) {
109     printAMIndexedWB(MI, OpNum, BitWidth / 8, O);
110   }
111
112   void printAMNoIndex(const MCInst *MI, unsigned OpNum,
113                       const MCSubtargetInfo &STI, raw_ostream &O);
114
115   template <int Scale>
116   void printImmScale(const MCInst *MI, unsigned OpNum,
117                      const MCSubtargetInfo &STI, raw_ostream &O);
118
119   void printPrefetchOp(const MCInst *MI, unsigned OpNum,
120                        const MCSubtargetInfo &STI, raw_ostream &O);
121
122   void printPSBHintOp(const MCInst *MI, unsigned OpNum,
123                       const MCSubtargetInfo &STI, raw_ostream &O);
124
125   void printFPImmOperand(const MCInst *MI, unsigned OpNum,
126                          const MCSubtargetInfo &STI, raw_ostream &O);
127
128   void printVectorList(const MCInst *MI, unsigned OpNum,
129                        const MCSubtargetInfo &STI, raw_ostream &O,
130                        StringRef LayoutSuffix);
131
132   /// Print a list of vector registers where the type suffix is implicit
133   /// (i.e. attached to the instruction rather than the registers).
134   void printImplicitlyTypedVectorList(const MCInst *MI, unsigned OpNum,
135                                       const MCSubtargetInfo &STI,
136                                       raw_ostream &O);
137
138   template <unsigned NumLanes, char LaneKind>
139   void printTypedVectorList(const MCInst *MI, unsigned OpNum,
140                             const MCSubtargetInfo &STI, raw_ostream &O);
141
142   void printVectorIndex(const MCInst *MI, unsigned OpNum,
143                         const MCSubtargetInfo &STI, raw_ostream &O);
144   void printAdrpLabel(const MCInst *MI, unsigned OpNum,
145                       const MCSubtargetInfo &STI, raw_ostream &O);
146   void printBarrierOption(const MCInst *MI, unsigned OpNum,
147                           const MCSubtargetInfo &STI, raw_ostream &O);
148   void printMSRSystemRegister(const MCInst *MI, unsigned OpNum,
149                               const MCSubtargetInfo &STI, raw_ostream &O);
150   void printMRSSystemRegister(const MCInst *MI, unsigned OpNum,
151                               const MCSubtargetInfo &STI, raw_ostream &O);
152   void printSystemPStateField(const MCInst *MI, unsigned OpNum,
153                               const MCSubtargetInfo &STI, raw_ostream &O);
154   void printSIMDType10Operand(const MCInst *MI, unsigned OpNum,
155                               const MCSubtargetInfo &STI, raw_ostream &O);
156   template<unsigned size>
157   void printGPRSeqPairsClassOperand(const MCInst *MI, unsigned OpNum,
158                                     const MCSubtargetInfo &STI,
159                                     raw_ostream &O);
160 };
161
162 class AArch64AppleInstPrinter : public AArch64InstPrinter {
163 public:
164   AArch64AppleInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
165                           const MCRegisterInfo &MRI);
166
167   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
168                  const MCSubtargetInfo &STI) override;
169
170   void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
171                         raw_ostream &O) override;
172   bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
173                        raw_ostream &O) override;
174   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
175                                unsigned PrintMethodIdx,
176                                const MCSubtargetInfo &STI,
177                                raw_ostream &O) override;
178   StringRef getRegName(unsigned RegNo) const override {
179     return getRegisterName(RegNo);
180   }
181   static const char *getRegisterName(unsigned RegNo,
182                                      unsigned AltIdx = AArch64::NoRegAltName);
183 };
184 }
185
186 #endif