50 lines · c
1//===-- BPFFrameLowering.h - Define frame lowering for BPF -----*- C++ -*--===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H10#define LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H11 12#include "BPFTargetMachine.h"13#include "BTFDebug.h"14#include "llvm/CodeGen/AsmPrinter.h"15 16namespace llvm {17 18class BPFAsmPrinter : public AsmPrinter {19public:20 explicit BPFAsmPrinter(TargetMachine &TM,21 std::unique_ptr<MCStreamer> Streamer)22 : AsmPrinter(TM, std::move(Streamer), ID), BTF(nullptr), TM(TM) {}23 24 StringRef getPassName() const override { return "BPF Assembly Printer"; }25 bool doInitialization(Module &M) override;26 bool doFinalization(Module &M) override;27 void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O);28 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,29 const char *ExtraCode, raw_ostream &O) override;30 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,31 const char *ExtraCode, raw_ostream &O) override;32 33 void emitInstruction(const MachineInstr *MI) override;34 MCSymbol *getJTPublicSymbol(unsigned JTI);35 void emitJumpTableInfo() override;36 37 static char ID;38 39private:40 BTFDebug *BTF;41 TargetMachine &TM;42 bool SawTrapCall = false;43 44 const BPFTargetMachine &getBTM() const;45};46 47} // namespace llvm48 49#endif /* LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H */50