2009-05-15 01:12:28 +00:00
|
|
|
//===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-05-15 01:12:28 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains support for writing dwarf exception info into asm files.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
|
|
|
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
2009-05-15 01:12:28 +00:00
|
|
|
|
2014-06-11 01:19:03 +00:00
|
|
|
#include "EHStreamer.h"
|
2011-05-10 18:39:09 +00:00
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
2016-02-26 20:30:37 +00:00
|
|
|
#include "llvm/MC/MCDwarf.h"
|
2009-05-15 01:12:28 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-04-05 05:28:23 +00:00
|
|
|
class MachineFunction;
|
2013-10-08 13:08:17 +00:00
|
|
|
class ARMTargetStreamer;
|
2011-01-14 21:57:45 +00:00
|
|
|
|
Cleanup unwind table emission code a bit.
This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:
1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.
Case 3 has been fixed in the generator, and the others are now handled
during table emission.
This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.
Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.
2023-01-06 13:26:03 -05:00
|
|
|
class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public EHStreamer {
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_personality should be emitted.
|
2022-01-30 12:32:51 -08:00
|
|
|
bool shouldEmitPersonality = false;
|
2011-04-29 14:48:51 +00:00
|
|
|
|
2016-02-26 20:30:37 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_personality must be emitted.
|
2022-01-30 12:32:51 -08:00
|
|
|
bool forceEmitPersonality = false;
|
2016-02-26 20:30:37 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_lsda should be emitted.
|
2022-01-30 12:32:51 -08:00
|
|
|
bool shouldEmitLSDA = false;
|
2011-01-14 21:57:53 +00:00
|
|
|
|
Cleanup unwind table emission code a bit.
This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:
1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.
Case 3 has been fixed in the generator, and the others are now handled
during table emission.
This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.
Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.
2023-01-06 13:26:03 -05:00
|
|
|
/// Per-function flag to indicate if frame CFI info should be emitted.
|
|
|
|
bool shouldEmitCFI = false;
|
|
|
|
|
|
|
|
/// Per-module flag to indicate if .cfi_section has beeen emitted.
|
|
|
|
bool hasEmittedCFISections = false;
|
|
|
|
|
2023-01-16 18:15:01 -05:00
|
|
|
/// Vector of all personality functions seen so far in the module.
|
|
|
|
std::vector<const GlobalValue *> Personalities;
|
|
|
|
|
|
|
|
void addPersonality(const GlobalValue *Personality);
|
|
|
|
|
2011-01-14 21:57:53 +00:00
|
|
|
public:
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Main entry points.
|
|
|
|
//
|
|
|
|
DwarfCFIException(AsmPrinter *A);
|
2015-04-11 02:11:45 +00:00
|
|
|
~DwarfCFIException() override;
|
2011-01-14 21:57:53 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Emit all exception information that should come after the content.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endModule() override;
|
2009-05-15 01:12:28 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Gather pre-function exception information. Assumes being emitted
|
|
|
|
/// immediately after the function entry point.
|
2014-03-08 06:31:39 +00:00
|
|
|
void beginFunction(const MachineFunction *MF) override;
|
2009-05-15 01:12:28 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Gather and emit post-function exception information.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endFunction(const MachineFunction *) override;
|
2016-02-26 20:30:37 +00:00
|
|
|
|
2022-11-22 13:35:43 -05:00
|
|
|
void beginBasicBlockSection(const MachineBasicBlock &MBB) override;
|
|
|
|
void endBasicBlockSection(const MachineBasicBlock &MBB) override;
|
2009-05-15 01:12:28 +00:00
|
|
|
};
|
|
|
|
|
Cleanup unwind table emission code a bit.
This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:
1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.
Case 3 has been fixed in the generator, and the others are now handled
during table emission.
This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.
Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.
2023-01-06 13:26:03 -05:00
|
|
|
class LLVM_LIBRARY_VISIBILITY ARMException : public EHStreamer {
|
|
|
|
/// Per-function flag to indicate if frame CFI info should be emitted.
|
|
|
|
bool shouldEmitCFI = false;
|
|
|
|
|
|
|
|
/// Per-module flag to indicate if .cfi_section has beeen emitted.
|
|
|
|
bool hasEmittedCFISections = false;
|
|
|
|
|
2018-02-09 17:00:25 +00:00
|
|
|
void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;
|
2013-10-08 13:08:17 +00:00
|
|
|
ARMTargetStreamer &getTargetStreamer();
|
|
|
|
|
2011-03-05 18:43:15 +00:00
|
|
|
public:
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Main entry points.
|
|
|
|
//
|
|
|
|
ARMException(AsmPrinter *A);
|
2015-04-11 02:11:45 +00:00
|
|
|
~ARMException() override;
|
2011-03-05 18:43:15 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Emit all exception information that should come after the content.
|
2017-01-02 18:05:27 +00:00
|
|
|
void endModule() override {}
|
2011-03-05 18:43:15 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Gather pre-function exception information. Assumes being emitted
|
|
|
|
/// immediately after the function entry point.
|
2014-03-08 06:31:39 +00:00
|
|
|
void beginFunction(const MachineFunction *MF) override;
|
2011-03-05 18:43:15 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Gather and emit post-function exception information.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endFunction(const MachineFunction *) override;
|
2022-11-22 13:35:43 -05:00
|
|
|
|
|
|
|
void markFunctionEnd() override;
|
2011-03-05 18:43:15 +00:00
|
|
|
};
|
2020-12-02 14:48:52 +00:00
|
|
|
|
Cleanup unwind table emission code a bit.
This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:
1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.
Case 3 has been fixed in the generator, and the others are now handled
during table emission.
This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.
Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.
2023-01-06 13:26:03 -05:00
|
|
|
class LLVM_LIBRARY_VISIBILITY AIXException : public EHStreamer {
|
2020-12-02 14:48:52 +00:00
|
|
|
/// This is AIX's compat unwind section, which unwinder would use
|
|
|
|
/// to find the location of LSDA area and personality rountine.
|
|
|
|
void emitExceptionInfoTable(const MCSymbol *LSDA, const MCSymbol *PerSym);
|
|
|
|
|
|
|
|
public:
|
|
|
|
AIXException(AsmPrinter *A);
|
|
|
|
|
|
|
|
void endModule() override {}
|
|
|
|
void beginFunction(const MachineFunction *MF) override {}
|
|
|
|
void endFunction(const MachineFunction *MF) override;
|
|
|
|
};
|
2009-05-15 01:12:28 +00:00
|
|
|
} // End of namespace llvm
|
|
|
|
|
|
|
|
#endif
|