Path: blob/main/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonAsmPrinter.h
35269 views
//===- HexagonAsmPrinter.h - Print machine code -----------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Hexagon Assembly printer class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H13#define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H1415#include "HexagonSubtarget.h"16#include "llvm/CodeGen/AsmPrinter.h"17#include "llvm/CodeGen/MachineFunction.h"18#include "llvm/MC/MCStreamer.h"19#include <utility>2021namespace llvm {2223class MachineInstr;24class MCInst;25class raw_ostream;26class TargetMachine;2728class HexagonAsmPrinter : public AsmPrinter {29const HexagonSubtarget *Subtarget = nullptr;3031void emitAttributes();3233public:34explicit HexagonAsmPrinter(TargetMachine &TM,35std::unique_ptr<MCStreamer> Streamer)36: AsmPrinter(TM, std::move(Streamer)) {}3738bool runOnMachineFunction(MachineFunction &Fn) override {39Subtarget = &Fn.getSubtarget<HexagonSubtarget>();40const bool Modified = AsmPrinter::runOnMachineFunction(Fn);41// Emit the XRay table for this function.42emitXRayTable();4344return Modified;45}4647StringRef getPassName() const override {48return "Hexagon Assembly Printer";49}5051bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)52const override;5354void emitInstruction(const MachineInstr *MI) override;5556//===------------------------------------------------------------------===//57// XRay implementation58//===------------------------------------------------------------------===//59// XRay-specific lowering for Hexagon.60void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);61void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);62void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);63void EmitSled(const MachineInstr &MI, SledKind Kind);6465void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);6667void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);68bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,69const char *ExtraCode, raw_ostream &OS) override;70bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,71const char *ExtraCode, raw_ostream &OS) override;72void emitStartOfAsmFile(Module &M) override;73void emitEndOfAsmFile(Module &M) override;74};7576} // end namespace llvm7778#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H798081