Path: blob/main/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
35271 views
//===-- DwarfException.h - Dwarf Exception Framework -----------*- 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// This file contains support for writing dwarf exception info into asm files.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H13#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H1415#include "EHStreamer.h"16#include "llvm/CodeGen/AsmPrinter.h"17#include "llvm/MC/MCDwarf.h"1819namespace llvm {20class MachineFunction;21class ARMTargetStreamer;2223class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public EHStreamer {24/// Per-function flag to indicate if .cfi_personality should be emitted.25bool shouldEmitPersonality = false;2627/// Per-function flag to indicate if .cfi_personality must be emitted.28bool forceEmitPersonality = false;2930/// Per-function flag to indicate if .cfi_lsda should be emitted.31bool shouldEmitLSDA = false;3233/// Per-function flag to indicate if frame CFI info should be emitted.34bool shouldEmitCFI = false;3536/// Per-module flag to indicate if .cfi_section has beeen emitted.37bool hasEmittedCFISections = false;3839/// Vector of all personality functions seen so far in the module.40std::vector<const GlobalValue *> Personalities;4142void addPersonality(const GlobalValue *Personality);4344public:45//===--------------------------------------------------------------------===//46// Main entry points.47//48DwarfCFIException(AsmPrinter *A);49~DwarfCFIException() override;5051/// Emit all exception information that should come after the content.52void endModule() override;5354/// Gather pre-function exception information. Assumes being emitted55/// immediately after the function entry point.56void beginFunction(const MachineFunction *MF) override;5758/// Gather and emit post-function exception information.59void endFunction(const MachineFunction *) override;6061void beginBasicBlockSection(const MachineBasicBlock &MBB) override;62void endBasicBlockSection(const MachineBasicBlock &MBB) override;63};6465class LLVM_LIBRARY_VISIBILITY ARMException : public EHStreamer {66/// Per-function flag to indicate if frame CFI info should be emitted.67bool shouldEmitCFI = false;6869/// Per-module flag to indicate if .cfi_section has beeen emitted.70bool hasEmittedCFISections = false;7172void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;73ARMTargetStreamer &getTargetStreamer();7475public:76//===--------------------------------------------------------------------===//77// Main entry points.78//79ARMException(AsmPrinter *A);80~ARMException() override;8182/// Emit all exception information that should come after the content.83void endModule() override {}8485/// Gather pre-function exception information. Assumes being emitted86/// immediately after the function entry point.87void beginFunction(const MachineFunction *MF) override;8889/// Gather and emit post-function exception information.90void endFunction(const MachineFunction *) override;9192void markFunctionEnd() override;93};9495class LLVM_LIBRARY_VISIBILITY AIXException : public EHStreamer {96/// This is AIX's compat unwind section, which unwinder would use97/// to find the location of LSDA area and personality rountine.98void emitExceptionInfoTable(const MCSymbol *LSDA, const MCSymbol *PerSym);99100public:101AIXException(AsmPrinter *A);102103void endModule() override {}104void beginFunction(const MachineFunction *MF) override {}105void endFunction(const MachineFunction *MF) override;106};107} // End of namespace llvm108109#endif110111112