Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:26

0001 //===-- llvm/CodeGen/AsmPrinterHandler.h -----------------------*- C++ -*--===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains a generic interface for AsmPrinter handlers,
0010 // like debug and EH info emitters.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CODEGEN_ASMPRINTERHANDLER_H
0015 #define LLVM_CODEGEN_ASMPRINTERHANDLER_H
0016 
0017 #include "llvm/Support/DataTypes.h"
0018 
0019 namespace llvm {
0020 
0021 class AsmPrinter;
0022 class MachineBasicBlock;
0023 class MachineFunction;
0024 class MachineInstr;
0025 class MCSymbol;
0026 class Module;
0027 
0028 typedef MCSymbol *ExceptionSymbolProvider(AsmPrinter *Asm,
0029                                           const MachineBasicBlock *MBB);
0030 
0031 /// Collects and handles AsmPrinter objects required to build debug
0032 /// or EH information.
0033 class AsmPrinterHandler {
0034 public:
0035   virtual ~AsmPrinterHandler();
0036 
0037   virtual void beginModule(Module *M) {}
0038 
0039   /// Emit all sections that should come after the content.
0040   virtual void endModule() = 0;
0041 
0042   /// Gather pre-function debug information.
0043   /// Every beginFunction(MF) call should be followed by an endFunction(MF)
0044   /// call.
0045   virtual void beginFunction(const MachineFunction *MF) = 0;
0046 
0047   // Emit any of function marker (like .cfi_endproc). This is called
0048   // before endFunction and cannot switch sections.
0049   virtual void markFunctionEnd();
0050 
0051   /// Gather post-function debug information.
0052   virtual void endFunction(const MachineFunction *MF) = 0;
0053 
0054   /// Process the beginning of a new basic-block-section within a
0055   /// function. Always called immediately after beginFunction for the first
0056   /// basic-block. When basic-block-sections are enabled, called before the
0057   /// first block of each such section.
0058   virtual void beginBasicBlockSection(const MachineBasicBlock &MBB) {}
0059 
0060   /// Process the end of a basic-block-section within a function. When
0061   /// basic-block-sections are enabled, called after the last block in each such
0062   /// section (including the last section in the function). When
0063   /// basic-block-sections are disabled, called at the end of a function,
0064   /// immediately prior to markFunctionEnd.
0065   virtual void endBasicBlockSection(const MachineBasicBlock &MBB) {}
0066 
0067   /// For symbols that have a size designated (e.g. common symbols),
0068   /// this tracks that size.
0069   virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) {}
0070 
0071   /// Process beginning of an instruction.
0072   virtual void beginInstruction(const MachineInstr *MI) {}
0073 
0074   /// Process end of an instruction.
0075   virtual void endInstruction() {}
0076 
0077   virtual void beginCodeAlignment(const MachineBasicBlock &MBB) {}
0078 
0079   /// Emit target-specific EH funclet machinery.
0080   virtual void beginFunclet(const MachineBasicBlock &MBB,
0081                             MCSymbol *Sym = nullptr) {}
0082   virtual void endFunclet() {}
0083 };
0084 
0085 } // End of namespace llvm
0086 
0087 #endif