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
|
|
|
|
2015-07-01 16:18:16 +00:00
|
|
|
class LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase : public EHStreamer {
|
2015-03-09 18:29:12 +00:00
|
|
|
protected:
|
|
|
|
DwarfCFIExceptionBase(AsmPrinter *A);
|
|
|
|
|
|
|
|
/// Per-function flag to indicate if frame CFI info should be emitted.
|
|
|
|
bool shouldEmitCFI;
|
2017-01-02 18:05:27 +00:00
|
|
|
/// Per-module flag to indicate if .cfi_section has beeen emitted.
|
|
|
|
bool hasEmittedCFISections;
|
2015-03-09 18:29:12 +00:00
|
|
|
|
|
|
|
void markFunctionEnd() override;
|
2016-02-26 20:30:37 +00:00
|
|
|
void endFragment() override;
|
2015-03-09 18:29:12 +00:00
|
|
|
};
|
|
|
|
|
2015-07-01 16:18:16 +00:00
|
|
|
class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public DwarfCFIExceptionBase {
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_personality should be emitted.
|
2011-04-29 14:48:51 +00:00
|
|
|
bool shouldEmitPersonality;
|
|
|
|
|
2016-02-26 20:30:37 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_personality must be emitted.
|
|
|
|
bool forceEmitPersonality;
|
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Per-function flag to indicate if .cfi_lsda should be emitted.
|
2011-04-29 14:48:51 +00:00
|
|
|
bool shouldEmitLSDA;
|
2011-01-14 21:57:53 +00:00
|
|
|
|
2015-03-09 18:11:42 +00:00
|
|
|
/// Per-function flag to indicate if frame moves info should be emitted.
|
2011-01-14 21:57:53 +00:00
|
|
|
bool shouldEmitMoves;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
void beginFragment(const MachineBasicBlock *MBB,
|
|
|
|
ExceptionSymbolProvider ESP) override;
|
2009-05-15 01:12:28 +00:00
|
|
|
};
|
|
|
|
|
2015-07-01 16:18:16 +00:00
|
|
|
class LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase {
|
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;
|
2011-03-05 18:43:15 +00:00
|
|
|
};
|
2009-05-15 01:12:28 +00:00
|
|
|
} // End of namespace llvm
|
|
|
|
|
|
|
|
#endif
|