LCOV - code coverage report
Current view: top level - lib/Target/AArch64/InstPrinter - AArch64InstPrinter.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 5 9 55.6 %
Date: 2018-06-17 00:07:59 Functions: 2 6 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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/ADT/StringRef.h"
      19             : #include "llvm/MC/MCInstPrinter.h"
      20             : #include "../Utils/AArch64BaseInfo.h"
      21             : 
      22             : namespace llvm {
      23             : 
      24        1965 : class AArch64InstPrinter : public MCInstPrinter {
      25             : public:
      26             :   AArch64InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
      27             :                      const MCRegisterInfo &MRI);
      28             : 
      29             :   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
      30             :                  const MCSubtargetInfo &STI) override;
      31             :   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
      32             : 
      33             :   // Autogenerated by tblgen.
      34             :   virtual void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
      35             :                                 raw_ostream &O);
      36             :   virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
      37             :                                raw_ostream &O);
      38             :   virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
      39             :                                        unsigned PrintMethodIdx,
      40             :                                        const MCSubtargetInfo &STI,
      41             :                                        raw_ostream &O);
      42             : 
      43           0 :   virtual StringRef getRegName(unsigned RegNo) const {
      44           0 :     return getRegisterName(RegNo);
      45             :   }
      46             : 
      47             :   static const char *getRegisterName(unsigned RegNo,
      48             :                                      unsigned AltIdx = AArch64::NoRegAltName);
      49             : 
      50             : protected:
      51             :   bool printSysAlias(const MCInst *MI, const MCSubtargetInfo &STI,
      52             :                      raw_ostream &O);
      53             :   // Operand printers
      54             :   void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
      55             :                     raw_ostream &O);
      56             :   void printImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
      57             :                 raw_ostream &O);
      58             :   void printImmHex(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
      59             :                    raw_ostream &O);
      60             :   template <typename T> void printImmSVE(T Value, raw_ostream &O);
      61             :   void printPostIncOperand(const MCInst *MI, unsigned OpNo, unsigned Imm,
      62             :                            raw_ostream &O);
      63             :   template <int Amount>
      64             :   void printPostIncOperand(const MCInst *MI, unsigned OpNo,
      65             :                            const MCSubtargetInfo &STI, raw_ostream &O) {
      66          12 :     printPostIncOperand(MI, OpNo, Amount, O);
      67             :   }
      68             : 
      69             :   void printVRegOperand(const MCInst *MI, unsigned OpNo,
      70             :                         const MCSubtargetInfo &STI, raw_ostream &O);
      71             :   void printSysCROperand(const MCInst *MI, unsigned OpNo,
      72             :                          const MCSubtargetInfo &STI, raw_ostream &O);
      73             :   void printAddSubImm(const MCInst *MI, unsigned OpNum,
      74             :                       const MCSubtargetInfo &STI, raw_ostream &O);
      75             :   template <typename T>
      76             :   void printLogicalImm(const MCInst *MI, unsigned OpNum,
      77             :                        const MCSubtargetInfo &STI, raw_ostream &O);
      78             :   void printShifter(const MCInst *MI, unsigned OpNum,
      79             :                     const MCSubtargetInfo &STI, raw_ostream &O);
      80             :   void printShiftedRegister(const MCInst *MI, unsigned OpNum,
      81             :                             const MCSubtargetInfo &STI, raw_ostream &O);
      82             :   void printExtendedRegister(const MCInst *MI, unsigned OpNum,
      83             :                              const MCSubtargetInfo &STI, raw_ostream &O);
      84             :   void printArithExtend(const MCInst *MI, unsigned OpNum,
      85             :                         const MCSubtargetInfo &STI, raw_ostream &O);
      86             : 
      87             :   void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O,
      88             :                       char SrcRegKind, unsigned Width);
      89             :   template <char SrcRegKind, unsigned Width>
      90             :   void printMemExtend(const MCInst *MI, unsigned OpNum,
      91             :                       const MCSubtargetInfo &STI, raw_ostream &O) {
      92         582 :     printMemExtend(MI, OpNum, O, SrcRegKind, Width);
      93             :   }
      94             :   template <bool SignedExtend, int ExtWidth, char SrcRegKind, char Suffix>
      95             :   void printRegWithShiftExtend(const MCInst *MI, unsigned OpNum,
      96             :                                const MCSubtargetInfo &STI, raw_ostream &O);
      97             :   void printCondCode(const MCInst *MI, unsigned OpNum,
      98             :                      const MCSubtargetInfo &STI, raw_ostream &O);
      99             :   void printInverseCondCode(const MCInst *MI, unsigned OpNum,
     100             :                             const MCSubtargetInfo &STI, raw_ostream &O);
     101             :   void printAlignedLabel(const MCInst *MI, unsigned OpNum,
     102             :                          const MCSubtargetInfo &STI, raw_ostream &O);
     103             :   void printUImm12Offset(const MCInst *MI, unsigned OpNum, unsigned Scale,
     104             :                          raw_ostream &O);
     105             :   void printAMIndexedWB(const MCInst *MI, unsigned OpNum, unsigned Scale,
     106             :                         raw_ostream &O);
     107             : 
     108             :   template <int Scale>
     109             :   void printUImm12Offset(const MCInst *MI, unsigned OpNum,
     110             :                          const MCSubtargetInfo &STI, raw_ostream &O) {
     111        5663 :     printUImm12Offset(MI, OpNum, Scale, O);
     112             :   }
     113             : 
     114             :   template <int BitWidth>
     115             :   void printAMIndexedWB(const MCInst *MI, unsigned OpNum,
     116             :                         const MCSubtargetInfo &STI, raw_ostream &O) {
     117             :     printAMIndexedWB(MI, OpNum, BitWidth / 8, O);
     118             :   }
     119             : 
     120             :   void printAMNoIndex(const MCInst *MI, unsigned OpNum,
     121             :                       const MCSubtargetInfo &STI, raw_ostream &O);
     122             : 
     123             :   template <int Scale>
     124             :   void printImmScale(const MCInst *MI, unsigned OpNum,
     125             :                      const MCSubtargetInfo &STI, raw_ostream &O);
     126             : 
     127             :   template <bool IsSVEPrefetch = false>
     128             :   void printPrefetchOp(const MCInst *MI, unsigned OpNum,
     129             :                        const MCSubtargetInfo &STI, raw_ostream &O);
     130             : 
     131             :   void printPSBHintOp(const MCInst *MI, unsigned OpNum,
     132             :                       const MCSubtargetInfo &STI, raw_ostream &O);
     133             : 
     134             :   void printFPImmOperand(const MCInst *MI, unsigned OpNum,
     135             :                          const MCSubtargetInfo &STI, raw_ostream &O);
     136             : 
     137             :   void printVectorList(const MCInst *MI, unsigned OpNum,
     138             :                        const MCSubtargetInfo &STI, raw_ostream &O,
     139             :                        StringRef LayoutSuffix);
     140             : 
     141             :   /// Print a list of vector registers where the type suffix is implicit
     142             :   /// (i.e. attached to the instruction rather than the registers).
     143             :   void printImplicitlyTypedVectorList(const MCInst *MI, unsigned OpNum,
     144             :                                       const MCSubtargetInfo &STI,
     145             :                                       raw_ostream &O);
     146             : 
     147             :   template <unsigned NumLanes, char LaneKind>
     148             :   void printTypedVectorList(const MCInst *MI, unsigned OpNum,
     149             :                             const MCSubtargetInfo &STI, raw_ostream &O);
     150             : 
     151             :   void printVectorIndex(const MCInst *MI, unsigned OpNum,
     152             :                         const MCSubtargetInfo &STI, raw_ostream &O);
     153             :   void printAdrpLabel(const MCInst *MI, unsigned OpNum,
     154             :                       const MCSubtargetInfo &STI, raw_ostream &O);
     155             :   void printBarrierOption(const MCInst *MI, unsigned OpNum,
     156             :                           const MCSubtargetInfo &STI, raw_ostream &O);
     157             :   void printMSRSystemRegister(const MCInst *MI, unsigned OpNum,
     158             :                               const MCSubtargetInfo &STI, raw_ostream &O);
     159             :   void printMRSSystemRegister(const MCInst *MI, unsigned OpNum,
     160             :                               const MCSubtargetInfo &STI, raw_ostream &O);
     161             :   void printSystemPStateField(const MCInst *MI, unsigned OpNum,
     162             :                               const MCSubtargetInfo &STI, raw_ostream &O);
     163             :   void printSIMDType10Operand(const MCInst *MI, unsigned OpNum,
     164             :                               const MCSubtargetInfo &STI, raw_ostream &O);
     165             :   template<int64_t Angle, int64_t Remainder>
     166             :   void printComplexRotationOp(const MCInst *MI, unsigned OpNo,
     167             :                             const MCSubtargetInfo &STI, raw_ostream &O);
     168             :   template<unsigned size>
     169             :   void printGPRSeqPairsClassOperand(const MCInst *MI, unsigned OpNum,
     170             :                                     const MCSubtargetInfo &STI,
     171             :                                     raw_ostream &O);
     172             :   template <typename T>
     173             :   void printImm8OptLsl(const MCInst *MI, unsigned OpNum,
     174             :                        const MCSubtargetInfo &STI, raw_ostream &O);
     175             :   template <typename T>
     176             :   void printSVELogicalImm(const MCInst *MI, unsigned OpNum,
     177             :                           const MCSubtargetInfo &STI, raw_ostream &O);
     178             :   void printSVEPattern(const MCInst *MI, unsigned OpNum,
     179             :                        const MCSubtargetInfo &STI, raw_ostream &O);
     180             :   template <char = 0>
     181             :   void printSVERegOp(const MCInst *MI, unsigned OpNum,
     182             :                     const MCSubtargetInfo &STI, raw_ostream &O);
     183             :   template <int Width>
     184             :   void printZPRasFPR(const MCInst *MI, unsigned OpNum,
     185             :                      const MCSubtargetInfo &STI, raw_ostream &O);
     186             :   template <unsigned ImmIs0, unsigned ImmIs1>
     187             :   void printExactFPImm(const MCInst *MI, unsigned OpNum,
     188             :                        const MCSubtargetInfo &STI, raw_ostream &O);
     189             : };
     190             : 
     191         820 : class AArch64AppleInstPrinter : public AArch64InstPrinter {
     192             : public:
     193             :   AArch64AppleInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
     194             :                           const MCRegisterInfo &MRI);
     195             : 
     196             :   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
     197             :                  const MCSubtargetInfo &STI) override;
     198             : 
     199             :   void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
     200             :                         raw_ostream &O) override;
     201             :   bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
     202             :                        raw_ostream &O) override;
     203             :   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
     204             :                                unsigned PrintMethodIdx,
     205             :                                const MCSubtargetInfo &STI,
     206             :                                raw_ostream &O) override;
     207             : 
     208           0 :   StringRef getRegName(unsigned RegNo) const override {
     209           0 :     return getRegisterName(RegNo);
     210             :   }
     211             : 
     212             :   static const char *getRegisterName(unsigned RegNo,
     213             :                                      unsigned AltIdx = AArch64::NoRegAltName);
     214             : };
     215             : 
     216             : } // end namespace llvm
     217             : 
     218             : #endif // LLVM_LIB_TARGET_AARCH64_INSTPRINTER_AARCH64INSTPRINTER_H

Generated by: LCOV version 1.13