LLVM  8.0.1
HexagonAsmPrinter.h
Go to the documentation of this file.
1 //===- HexagonAsmPrinter.h - Print machine code to an Hexagon .s file -----===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Hexagon Assembly printer class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
15 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
16 
17 #include "Hexagon.h"
18 #include "HexagonSubtarget.h"
21 #include "llvm/MC/MCStreamer.h"
22 #include <utility>
23 
24 namespace llvm {
25 
26 class MachineInstr;
27 class MCInst;
28 class raw_ostream;
29 class TargetMachine;
30 
31  class HexagonAsmPrinter : public AsmPrinter {
32  const HexagonSubtarget *Subtarget = nullptr;
33 
34  public:
36  std::unique_ptr<MCStreamer> Streamer)
37  : AsmPrinter(TM, std::move(Streamer)) {}
38 
40  Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
42  }
43 
44  StringRef getPassName() const override {
45  return "Hexagon Assembly Printer";
46  }
47 
49  const override;
50 
51  void EmitInstruction(const MachineInstr *MI) override;
52  void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
53 
54  void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
55  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
56  unsigned AsmVariant, const char *ExtraCode,
57  raw_ostream &OS) override;
58  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
59  unsigned AsmVariant, const char *ExtraCode,
60  raw_ostream &OS) override;
61  };
62 
63 } // end namespace llvm
64 
65 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool runOnMachineFunction(MachineFunction &Fn) override
Emit the specified function out to the OutStreamer.
Definition: BitVector.h:938
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:296
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:161
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:82
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:79
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O)
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) override
PrintAsmOperand - Print out an operand for an inline asm expression.
Representation of each machine instruction.
Definition: MachineInstr.h:64
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const override
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...