[x86] fix assert with horizontal math + broadcast of vector (PR43402)
[llvm-core.git] / lib / Target / Hexagon / HexagonAsmPrinter.h
blob6c4b664e83f52f6b38761920dc260c2b10fa9049
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 "HexagonSubtarget.h"
17 #include "llvm/CodeGen/AsmPrinter.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/MC/MCStreamer.h"
20 #include <utility>
22 namespace llvm {
24 class MachineInstr;
25 class MCInst;
26 class raw_ostream;
27 class TargetMachine;
29 class HexagonAsmPrinter : public AsmPrinter {
30 const HexagonSubtarget *Subtarget = nullptr;
32 public:
33 explicit HexagonAsmPrinter(TargetMachine &TM,
34 std::unique_ptr<MCStreamer> Streamer)
35 : AsmPrinter(TM, std::move(Streamer)) {}
37 bool runOnMachineFunction(MachineFunction &Fn) override {
38 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
39 return AsmPrinter::runOnMachineFunction(Fn);
42 StringRef getPassName() const override {
43 return "Hexagon Assembly Printer";
46 bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
47 const override;
49 void EmitInstruction(const MachineInstr *MI) override;
50 void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
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;
59 } // end namespace llvm
61 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H