LLVM  15.0.0git
HexagonAsmPrinter.h
Go to the documentation of this file.
1 //===- HexagonAsmPrinter.h - Print machine code to an Hexagon .s file -----===//
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 
22 namespace llvm {
23 
24 class MachineInstr;
25 class MCInst;
26 class raw_ostream;
27 class TargetMachine;
28 
29  class HexagonAsmPrinter : public AsmPrinter {
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.
41  emitXRayTable();
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
AsmPrinter.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:104
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::HexagonAsmPrinter::printOperand
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
Definition: HexagonAsmPrinter.cpp:75
HexagonSubtarget.h
llvm::AsmPrinter::SledKind
SledKind
Definition: AsmPrinter.h:324
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::HexagonAsmPrinter::PrintAsmOperand
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
PrintAsmOperand - Print out an operand for an inline asm expression.
Definition: HexagonAsmPrinter.cpp:114
llvm::HexagonAsmPrinter::EmitSled
void EmitSled(const MachineInstr &MI, SledKind Kind)
Definition: HexagonAsmPrinter.cpp:776
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
LoopDeletionResult::Modified
@ Modified
llvm::HexagonAsmPrinter::emitInstruction
void emitInstruction(const MachineInstr *MI) override
Print out a single Hexagon MI to the current output stream.
Definition: HexagonAsmPrinter.cpp:745
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:640
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
llvm::HexagonAsmPrinter::PrintAsmMemoryOperand
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...
Definition: HexagonAsmPrinter.cpp:155
llvm::HexagonAsmPrinter::HexagonProcessInstruction
void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB)
Definition: HexagonAsmPrinter.cpp:265
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::move
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:1665
llvm::HexagonAsmPrinter::isBlockOnlyReachableByFallthrough
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const override
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
Definition: HexagonAsmPrinter.cpp:106
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::AsmPrinter::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:376
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::HexagonAsmPrinter::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &Fn) override
Emit the specified function out to the OutStreamer.
Definition: HexagonAsmPrinter.h:37
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
std
Definition: BitVector.h:851
llvm::HexagonAsmPrinter::HexagonAsmPrinter
HexagonAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
Definition: HexagonAsmPrinter.h:33
llvm::HexagonAsmPrinter::LowerPATCHABLE_FUNCTION_ENTER
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
Definition: HexagonAsmPrinter.cpp:825
llvm::HexagonAsmPrinter::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: HexagonAsmPrinter.h:46
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
llvm::HexagonAsmPrinter::LowerPATCHABLE_FUNCTION_EXIT
void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI)
Definition: HexagonAsmPrinter.cpp:829
llvm::AsmPrinter::TM
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:84
MCStreamer.h
llvm::HexagonAsmPrinter::LowerPATCHABLE_TAIL_CALL
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
Definition: HexagonAsmPrinter.cpp:833
llvm::HexagonSubtarget
Definition: HexagonSubtarget.h:43
llvm::AsmPrinter::emitXRayTable
void emitXRayTable()
Emit a table with all XRay instrumentation points.
Definition: AsmPrinter.cpp:3679
MachineFunction.h
llvm::HexagonAsmPrinter
Definition: HexagonAsmPrinter.h:29