LLVM 18.0.0git
HexagonAsmPrinter.h
Go to the documentation of this file.
1//===- HexagonAsmPrinter.h - Print machine code -----------------*- 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// Hexagon Assembly printer class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
14#define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
15
16#include "HexagonSubtarget.h"
19#include "llvm/MC/MCStreamer.h"
20#include <utility>
21
22namespace llvm {
23
24class MachineInstr;
25class MCInst;
26class raw_ostream;
27class TargetMachine;
28
30 const HexagonSubtarget *Subtarget = nullptr;
31
32 public:
34 std::unique_ptr<MCStreamer> Streamer)
35 : AsmPrinter(TM, std::move(Streamer)) {}
36
38 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
40 // Emit the XRay table for this function.
42
43 return Modified;
44 }
45
46 StringRef getPassName() const override {
47 return "Hexagon Assembly Printer";
48 }
49
51 const override;
52
53 void emitInstruction(const MachineInstr *MI) override;
54
55 //===------------------------------------------------------------------===//
56 // XRay implementation
57 //===------------------------------------------------------------------===//
58 // XRay-specific lowering for Hexagon.
62 void EmitSled(const MachineInstr &MI, SledKind Kind);
63
65
66 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
67 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
68 const char *ExtraCode, raw_ostream &OS) override;
69 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
70 const char *ExtraCode, raw_ostream &OS) override;
71 };
72
73} // end namespace llvm
74
75#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
MachineBasicBlock & MBB
IRTranslator LLVM IR MI
raw_pwrite_stream & OS
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:84
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:87
void emitXRayTable()
Emit a table with all XRay instrumentation points.
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:399
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
void EmitSled(const MachineInstr &MI, SledKind Kind)
void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI)
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const override
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
PrintAsmOperand - Print out an operand for an inline asm expression.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
void emitInstruction(const MachineInstr *MI) override
Print out a single Hexagon MI to the current output stream.
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
HexagonAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
bool runOnMachineFunction(MachineFunction &Fn) override
Emit the specified function out to the OutStreamer.
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
Definition: MachineInstr.h:68
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:78
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1853
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858