Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / Hexagon / HexagonAsmPrinter.h
blobbaf0999b30121bd493f2165f6474be3e9c3bf566
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
14 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
16 #include "Hexagon.h"
17 #include "HexagonSubtarget.h"
18 #include "llvm/CodeGen/AsmPrinter.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/MC/MCStreamer.h"
21 #include <utility>
23 namespace llvm {
25 class MachineInstr;
26 class MCInst;
27 class raw_ostream;
28 class TargetMachine;
30 class HexagonAsmPrinter : public AsmPrinter {
31 const HexagonSubtarget *Subtarget = nullptr;
33 public:
34 explicit HexagonAsmPrinter(TargetMachine &TM,
35 std::unique_ptr<MCStreamer> Streamer)
36 : AsmPrinter(TM, std::move(Streamer)) {}
38 bool runOnMachineFunction(MachineFunction &Fn) override {
39 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
40 return AsmPrinter::runOnMachineFunction(Fn);
43 StringRef getPassName() const override {
44 return "Hexagon Assembly Printer";
47 bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
48 const override;
50 void EmitInstruction(const MachineInstr *MI) override;
51 void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
53 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
54 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
55 unsigned AsmVariant, const char *ExtraCode,
56 raw_ostream &OS) override;
57 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
58 unsigned AsmVariant, const char *ExtraCode,
59 raw_ostream &OS) override;
62 } // end namespace llvm
64 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H