DwarfException.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //===-- DwarfException.h - Dwarf Exception Framework -----------*- 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-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file contains support for writing dwarf exception info into asm files.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
  13. #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
  14. #include "EHStreamer.h"
  15. #include "llvm/CodeGen/AsmPrinter.h"
  16. #include "llvm/MC/MCDwarf.h"
  17. namespace llvm {
  18. class MachineFunction;
  19. class ARMTargetStreamer;
  20. class LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase : public EHStreamer {
  21. protected:
  22. DwarfCFIExceptionBase(AsmPrinter *A);
  23. /// Per-function flag to indicate if frame CFI info should be emitted.
  24. bool shouldEmitCFI;
  25. /// Per-module flag to indicate if .cfi_section has beeen emitted.
  26. bool hasEmittedCFISections;
  27. void markFunctionEnd() override;
  28. void endFragment() override;
  29. };
  30. class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public DwarfCFIExceptionBase {
  31. /// Per-function flag to indicate if .cfi_personality should be emitted.
  32. bool shouldEmitPersonality;
  33. /// Per-function flag to indicate if .cfi_personality must be emitted.
  34. bool forceEmitPersonality;
  35. /// Per-function flag to indicate if .cfi_lsda should be emitted.
  36. bool shouldEmitLSDA;
  37. /// Per-function flag to indicate if frame moves info should be emitted.
  38. bool shouldEmitMoves;
  39. public:
  40. //===--------------------------------------------------------------------===//
  41. // Main entry points.
  42. //
  43. DwarfCFIException(AsmPrinter *A);
  44. ~DwarfCFIException() override;
  45. /// Emit all exception information that should come after the content.
  46. void endModule() override;
  47. /// Gather pre-function exception information. Assumes being emitted
  48. /// immediately after the function entry point.
  49. void beginFunction(const MachineFunction *MF) override;
  50. /// Gather and emit post-function exception information.
  51. void endFunction(const MachineFunction *) override;
  52. void beginFragment(const MachineBasicBlock *MBB,
  53. ExceptionSymbolProvider ESP) override;
  54. };
  55. class LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase {
  56. void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;
  57. ARMTargetStreamer &getTargetStreamer();
  58. public:
  59. //===--------------------------------------------------------------------===//
  60. // Main entry points.
  61. //
  62. ARMException(AsmPrinter *A);
  63. ~ARMException() override;
  64. /// Emit all exception information that should come after the content.
  65. void endModule() override {}
  66. /// Gather pre-function exception information. Assumes being emitted
  67. /// immediately after the function entry point.
  68. void beginFunction(const MachineFunction *MF) override;
  69. /// Gather and emit post-function exception information.
  70. void endFunction(const MachineFunction *) override;
  71. };
  72. } // End of namespace llvm
  73. #endif