LLVM 19.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 void emitAttributes();
33
34 public:
36 std::unique_ptr<MCStreamer> Streamer)
37 : AsmPrinter(TM, std::move(Streamer)) {}
38
40 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
42 // Emit the XRay table for this function.
44
45 return Modified;
46 }
47
48 StringRef getPassName() const override {
49 return "Hexagon Assembly Printer";
50 }
51
53 const override;
54
55 void emitInstruction(const MachineInstr *MI) override;
56
57 //===------------------------------------------------------------------===//
58 // XRay implementation
59 //===------------------------------------------------------------------===//
60 // XRay-specific lowering for Hexagon.
64 void EmitSled(const MachineInstr &MI, SledKind Kind);
65
67
68 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
69 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
70 const char *ExtraCode, raw_ostream &OS) override;
71 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
72 const char *ExtraCode, raw_ostream &OS) override;
73 void emitStartOfAsmFile(Module &M) override;
74 void emitEndOfAsmFile(Module &M) override;
75 };
76
77} // end namespace llvm
78
79#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:395
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 emitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
void emitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
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:69
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
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:76
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:1858
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858