LLVM  9.0.0svn
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  }
41 
42  StringRef getPassName() const override {
43  return "Hexagon Assembly Printer";
44  }
45 
47  const override;
48 
49  void EmitInstruction(const MachineInstr *MI) override;
50  void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
51 
52  void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
53  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
54  const char *ExtraCode, raw_ostream &OS) override;
55  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
56  const char *ExtraCode, raw_ostream &OS) override;
57  };
58 
59 } // end namespace llvm
60 
61 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool runOnMachineFunction(MachineFunction &Fn) override
Emit the specified function out to the OutStreamer.
Definition: BitVector.h:937
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 runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:295
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.
HexagonAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:81
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:78
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
Representation of each machine instruction.
Definition: MachineInstr.h:63
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
PrintAsmOperand - Print out an operand for an inline asm expression.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:65
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const override
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...