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 "Hexagon.h"
17 #include "HexagonSubtarget.h"
20 #include "llvm/MC/MCStreamer.h"
21 #include <utility>
22 
23 namespace llvm {
24 
25 class MachineInstr;
26 class MCInst;
27 class raw_ostream;
28 class TargetMachine;
29 
30  class HexagonAsmPrinter : public AsmPrinter {
31  const HexagonSubtarget *Subtarget = nullptr;
32 
33  public:
35  std::unique_ptr<MCStreamer> Streamer)
36  : AsmPrinter(TM, std::move(Streamer)) {}
37 
39  Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
41  }
42 
43  StringRef getPassName() const override {
44  return "Hexagon Assembly Printer";
45  }
46 
48  const override;
49 
50  void EmitInstruction(const MachineInstr *MI) override;
51  void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
52 
53  void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
54  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
55  const char *ExtraCode, raw_ostream &OS) override;
56  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
57  const char *ExtraCode, raw_ostream &OS) override;
58  };
59 
60 } // end namespace llvm
61 
62 #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...