WinException.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //===-- WinException.h - Windows Exception Handling ----------*- C++ -*--===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file contains support for writing windows exception info into asm files.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WIN64EXCEPTION_H
  14. #define LLVM_LIB_CODEGEN_ASMPRINTER_WIN64EXCEPTION_H
  15. #include "EHStreamer.h"
  16. namespace llvm {
  17. class Function;
  18. class GlobalValue;
  19. class MachineFunction;
  20. class MCExpr;
  21. struct WinEHFuncInfo;
  22. class LLVM_LIBRARY_VISIBILITY WinException : public EHStreamer {
  23. /// Per-function flag to indicate if personality info should be emitted.
  24. bool shouldEmitPersonality = false;
  25. /// Per-function flag to indicate if the LSDA should be emitted.
  26. bool shouldEmitLSDA = false;
  27. /// Per-function flag to indicate if frame moves info should be emitted.
  28. bool shouldEmitMoves = false;
  29. /// True if this is a 64-bit target and we should use image relative offsets.
  30. bool useImageRel32 = false;
  31. void emitCSpecificHandlerTable();
  32. /// Emit the EH table data for 32-bit and 64-bit functions using
  33. /// the __CxxFrameHandler3 personality.
  34. void emitCXXFrameHandler3Table(const MachineFunction *MF);
  35. /// Emit the EH table data for _except_handler3 and _except_handler4
  36. /// personality functions. These are only used on 32-bit and do not use CFI
  37. /// tables.
  38. void emitExceptHandlerTable(const MachineFunction *MF);
  39. void extendIP2StateTable(const MachineFunction *MF, const Function *ParentF,
  40. WinEHFuncInfo &FuncInfo);
  41. /// Emits the label used with llvm.x86.seh.recoverfp, which is used by
  42. /// outlined funclets.
  43. void emitEHRegistrationOffsetLabel(const WinEHFuncInfo &FuncInfo,
  44. StringRef FLinkageName);
  45. const MCExpr *create32bitRef(const MCSymbol *Value);
  46. const MCExpr *create32bitRef(const GlobalValue *GV);
  47. public:
  48. //===--------------------------------------------------------------------===//
  49. // Main entry points.
  50. //
  51. WinException(AsmPrinter *A);
  52. ~WinException() override;
  53. /// Emit all exception information that should come after the content.
  54. void endModule() override;
  55. /// Gather pre-function exception information. Assumes being emitted
  56. /// immediately after the function entry point.
  57. void beginFunction(const MachineFunction *MF) override;
  58. /// Gather and emit post-function exception information.
  59. void endFunction(const MachineFunction *) override;
  60. };
  61. }
  62. #endif