LLVM 24.0.0git
PPCInstPrinter.h
Go to the documentation of this file.
1//===- PPCInstPrinter.h - Convert PPC MCInst to assembly syntax -*- 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// This class prints an PPC MCInst to a .s file.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCINSTPRINTER_H
14#define LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCINSTPRINTER_H
15
19
20namespace llvm {
21
23 const PPCMCOptions &CLOpts;
24 Triple TT;
25private:
26 bool showRegistersWithPercentPrefix(const char *RegName) const;
27 bool showRegistersWithPrefix() const;
28 const char *getVerboseConditionRegName(MCRegister Reg,
29 unsigned RegEncoding) const;
30
31public:
33 const MCRegisterInfo &MRI, Triple T);
34
35 void printRegName(raw_ostream &OS, MCRegister Reg) override;
36 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
37 const MCSubtargetInfo &STI, raw_ostream &O) override;
38
39 // Autogenerated by tblgen.
40 std::pair<const char *, uint64_t>
41 getMnemonic(const MCInst &MI) const override;
43 const MCSubtargetInfo &STI, raw_ostream &O);
44 static const char *getRegisterName(MCRegister Reg);
45
47 const MCSubtargetInfo &STI, raw_ostream &OS);
49 unsigned OpIdx, unsigned PrintMethodIdx,
50 const MCSubtargetInfo &STI, raw_ostream &OS);
51
52 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
53 raw_ostream &O);
54 void printPredicateOperand(const MCInst *MI, unsigned OpNo,
55 const MCSubtargetInfo &STI, raw_ostream &O,
56 StringRef Modifier = {});
57 void printATBitsAsHint(const MCInst *MI, unsigned OpNo,
58 const MCSubtargetInfo &STI, raw_ostream &O);
59
60 // Template for unsigned immediate operands with validation.
61 template <unsigned Width>
62 void printUImmOperand(const MCInst *MI, unsigned OpNo,
63 const MCSubtargetInfo &STI, raw_ostream &O);
64
65 // Template for signed immediate operands with sign extension.
66 template <unsigned Width>
67 void printSImmOperand(const MCInst *MI, unsigned OpNo,
68 const MCSubtargetInfo &STI, raw_ostream &O);
69
70 void printU8ImmOperandTrunc(const MCInst *MI, unsigned OpNo,
71 const MCSubtargetInfo &STI, raw_ostream &O);
72 void printS16ImmOperand(const MCInst *MI, unsigned OpNo,
73 const MCSubtargetInfo &STI, raw_ostream &O);
74 void printS32ImmOperand(const MCInst *MI, unsigned OpNo,
75 const MCSubtargetInfo &STI, raw_ostream &O);
76 void printNegS32ImmOperand(const MCInst *MI, unsigned OpNo,
77 const MCSubtargetInfo &STI, raw_ostream &O);
78 void printS34ImmOperand(const MCInst *MI, unsigned OpNo,
79 const MCSubtargetInfo &STI, raw_ostream &O);
80 void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
81 const MCSubtargetInfo &STI, raw_ostream &O);
82 void printImmZeroOperand(const MCInst *MI, unsigned OpNo,
83 const MCSubtargetInfo &STI, raw_ostream &O);
84 void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,
85 const MCSubtargetInfo &STI, raw_ostream &O);
86 void printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
87 const MCSubtargetInfo &STI, raw_ostream &O);
88 void printTLSCall(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
89 raw_ostream &O);
90
91 void printcrbitm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
92 raw_ostream &O);
93
94 void printMemRegImm(const MCInst *MI, unsigned OpNo,
95 const MCSubtargetInfo &STI, raw_ostream &O);
96 void printMemRegImmHash(const MCInst *MI, unsigned OpNo,
97 const MCSubtargetInfo &STI, raw_ostream &O);
98 void printMemRegImm34PCRel(const MCInst *MI, unsigned OpNo,
99 const MCSubtargetInfo &STI, raw_ostream &O);
100 void printMemRegImm34(const MCInst *MI, unsigned OpNo,
101 const MCSubtargetInfo &STI, raw_ostream &O);
102 void printMemRegReg(const MCInst *MI, unsigned OpNo,
103 const MCSubtargetInfo &STI, raw_ostream &O);
104};
105} // end namespace llvm
106
107#endif
uint64_t uint64_t
IRTranslator LLVM IR MI
#define RegName(no)
Register Reg
#define T
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
const MCInstrInfo & MII
const MCRegisterInfo & MRI
const MCAsmInfo & MAI
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
Generic base class for all target subtargets.
void printMemRegImm34PCRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printcrbitm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printS32ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, const MCSubtargetInfo &STI, raw_ostream &OS)
bool printAliasInstr(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &OS)
void printMemRegReg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printPredicateOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printS34ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printS16ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI, Triple T)
void printNegS32ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
void printMemRegImm34(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
void printU16ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printSImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printMemRegImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printImmZeroOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printUImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printATBitsAsHint(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printTLSCall(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printU8ImmOperandTrunc(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printMemRegImmHash(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
std::pair< const char *, uint64_t > getMnemonic(const MCInst &MI) const override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.