summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-10-16 18:50:09 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-10-16 18:50:09 +0000
commit547d824da661fedaeeda3a4bcb83a3464fa1b7b9 (patch)
tree008630b0dc9e8141304feb83e81695e22d98b5fe /llvm/lib/CodeGen/AsmPrinter
parentae4e75fd6e89cb7706b218f54ea16a0bbdb9a0c2 (diff)
downloadbcm5719-llvm-547d824da661fedaeeda3a4bcb83a3464fa1b7b9.tar.gz
bcm5719-llvm-547d824da661fedaeeda3a4bcb83a3464fa1b7b9.zip
Revert "[WebAssembly] LSDA info generation"
This reverts commit r344575. Newly introduced test eh-lsda.ll.test fails with use-after-free under ASAN build. llvm-svn: 344639
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp3
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp10
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/EHStreamer.h11
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WasmException.cpp81
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WasmException.h42
6 files changed, 8 insertions, 140 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 526f7ce3083..63c5b262edc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -16,7 +16,6 @@
#include "CodeViewDebug.h"
#include "DwarfDebug.h"
#include "DwarfException.h"
-#include "WasmException.h"
#include "WinCFGuard.h"
#include "WinException.h"
#include "llvm/ADT/APFloat.h"
@@ -357,7 +356,7 @@ bool AsmPrinter::doInitialization(Module &M) {
}
break;
case ExceptionHandling::Wasm:
- ES = new WasmException(this);
+ // TODO to prevent warning
break;
}
if (ES)
diff --git a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
index 3fb088ab6f0..6cba4a0d4b8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
+++ b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
@@ -23,7 +23,6 @@ add_llvm_library(LLVMAsmPrinter
WinCFGuard.cpp
WinException.cpp
CodeViewDebug.cpp
- WasmException.cpp
DEPENDS
intrinsics_gen
diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
index 7599121de2b..be04b9a6e8c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -345,9 +345,7 @@ computeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
/// unwound and handling continues.
/// 3. Type ID table contains references to all the C++ typeinfo for all
/// catches in the function. This tables is reverse indexed base 1.
-///
-/// Returns the starting symbol of an exception table.
-MCSymbol *EHStreamer::emitExceptionTable() {
+void EHStreamer::emitExceptionTable() {
const MachineFunction *MF = Asm->MF;
const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();
const std::vector<unsigned> &FilterIds = MF->getFilterIds();
@@ -377,7 +375,6 @@ MCSymbol *EHStreamer::emitExceptionTable() {
computeCallSiteTable(CallSites, LandingPads, FirstActions);
bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
- bool IsWasm = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Wasm;
unsigned CallSiteEncoding =
IsSJLJ ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_uleb128;
bool HaveTTData = !TypeInfos.empty() || !FilterIds.empty();
@@ -460,8 +457,8 @@ MCSymbol *EHStreamer::emitExceptionTable() {
Asm->EmitLabelDifferenceAsULEB128(CstEndLabel, CstBeginLabel);
Asm->OutStreamer->EmitLabel(CstBeginLabel);
- // SjLj / Wasm Exception handling
- if (IsSJLJ || IsWasm) {
+ // SjLj Exception handling
+ if (IsSJLJ) {
unsigned idx = 0;
for (SmallVectorImpl<CallSiteEntry>::const_iterator
I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) {
@@ -607,7 +604,6 @@ MCSymbol *EHStreamer::emitExceptionTable() {
}
Asm->EmitAlignment(2);
- return GCCETSym;
}
void EHStreamer::emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) {
diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.h b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.h
index e3a6f8e9d58..b89421a1e06 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.h
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.h
@@ -85,10 +85,9 @@ protected:
/// zero for the landing pad and the action. Calls marked 'nounwind' have
/// no entry and must not be contained in the try-range of any entry - they
/// form gaps in the table. Entries must be ordered by try-range address.
- virtual void computeCallSiteTable(
- SmallVectorImpl<CallSiteEntry> &CallSites,
- const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
- const SmallVectorImpl<unsigned> &FirstActions);
+ void computeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
+ const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
+ const SmallVectorImpl<unsigned> &FirstActions);
/// Emit landing pads and actions.
///
@@ -109,9 +108,7 @@ protected:
/// found the frame is unwound and handling continues.
/// 3. Type id table contains references to all the C++ typeinfo for all
/// catches in the function. This tables is reversed indexed base 1.
- ///
- /// Returns the starting symbol of an exception table.
- MCSymbol *emitExceptionTable();
+ void emitExceptionTable();
virtual void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel);
diff --git a/llvm/lib/CodeGen/AsmPrinter/WasmException.cpp b/llvm/lib/CodeGen/AsmPrinter/WasmException.cpp
deleted file mode 100644
index 46745d08c9f..00000000000
--- a/llvm/lib/CodeGen/AsmPrinter/WasmException.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-//===-- CodeGen/AsmPrinter/WasmException.cpp - Wasm Exception Impl --------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains support for writing WebAssembly exception info into asm
-// files.
-//
-//===----------------------------------------------------------------------===//
-
-#include "WasmException.h"
-#include "llvm/MC/MCStreamer.h"
-using namespace llvm;
-
-void WasmException::markFunctionEnd() {
- // Get rid of any dead landing pads.
- if (!Asm->MF->getLandingPads().empty()) {
- auto *NonConstMF = const_cast<MachineFunction *>(Asm->MF);
- // Wasm does not set BeginLabel and EndLabel information for landing pads,
- // so we should set the second argument false.
- NonConstMF->tidyLandingPads(nullptr, /* TidyIfNoBeginLabels */ false);
- }
-}
-
-void WasmException::endFunction(const MachineFunction *MF) {
- bool ShouldEmitExceptionTable = false;
- for (const LandingPadInfo &Info : MF->getLandingPads()) {
- if (MF->hasWasmLandingPadIndex(Info.LandingPadBlock)) {
- ShouldEmitExceptionTable = true;
- break;
- }
- }
- if (!ShouldEmitExceptionTable)
- return;
- MCSymbol *LSDALabel = emitExceptionTable();
- assert(LSDALabel && ".GCC_exception_table has not been emitted!");
-
- // Wasm requires every data section symbol to have a .size set. So we emit an
- // end marker and set the size as the difference between the start end the end
- // marker.
- MCSymbol *LSDAEndLabel = Asm->createTempSymbol("GCC_except_table_end");
- Asm->OutStreamer->EmitLabel(LSDAEndLabel);
- MCContext &OutContext = Asm->OutStreamer->getContext();
- const MCExpr *SizeExp = MCBinaryExpr::createSub(
- MCSymbolRefExpr::create(LSDAEndLabel, OutContext),
- MCSymbolRefExpr::create(LSDALabel, OutContext), OutContext);
- Asm->OutStreamer->emitELFSize(LSDALabel, SizeExp);
-}
-
-// Compute the call-site table for wasm EH. Even though we use the same function
-// name to share the common routines, a call site entry in the table corresponds
-// to not a call site for possibly-throwing functions but a landing pad. In wasm
-// EH the VM is responsible for stack unwinding. After an exception occurs and
-// the stack is unwound, the control flow is transferred to wasm 'catch'
-// instruction by the VM, after which the personality function is called from
-// the compiler-generated code. Refer to WasmEHPrepare pass for more
-// information.
-void WasmException::computeCallSiteTable(
- SmallVectorImpl<CallSiteEntry> &CallSites,
- const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
- const SmallVectorImpl<unsigned> &FirstActions) {
- MachineFunction &MF = *Asm->MF;
- for (unsigned I = 0, N = LandingPads.size(); I < N; ++I) {
- const LandingPadInfo *Info = LandingPads[I];
- MachineBasicBlock *LPad = Info->LandingPadBlock;
- // We don't emit LSDA for single catch (...).
- if (!MF.hasWasmLandingPadIndex(LPad))
- continue;
- // Wasm EH must maintain the EH pads in the order assigned to them by the
- // WasmEHPrepare pass.
- unsigned LPadIndex = MF.getWasmLandingPadIndex(LPad);
- CallSiteEntry Site = {nullptr, nullptr, Info, FirstActions[I]};
- if (CallSites.size() < LPadIndex + 1)
- CallSites.resize(LPadIndex + 1);
- CallSites[LPadIndex] = Site;
- }
-}
diff --git a/llvm/lib/CodeGen/AsmPrinter/WasmException.h b/llvm/lib/CodeGen/AsmPrinter/WasmException.h
deleted file mode 100644
index 09a9a25ce8d..00000000000
--- a/llvm/lib/CodeGen/AsmPrinter/WasmException.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//===-- WasmException.h - Wasm Exception Framework -------------*- C++ -*--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains support for writing WebAssembly exception info into asm
-// files.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WASMEXCEPTION_H
-#define LLVM_LIB_CODEGEN_ASMPRINTER_WASMEXCEPTION_H
-
-#include "EHStreamer.h"
-#include "llvm/CodeGen/AsmPrinter.h"
-
-namespace llvm {
-
-class LLVM_LIBRARY_VISIBILITY WasmException : public EHStreamer {
-public:
- WasmException(AsmPrinter *A) : EHStreamer(A) {}
-
- void endModule() override {}
- void beginFunction(const MachineFunction *MF) override {}
- virtual void markFunctionEnd() override;
- void endFunction(const MachineFunction *MF) override;
-
-protected:
- // Compute the call site table for wasm EH.
- void computeCallSiteTable(
- SmallVectorImpl<CallSiteEntry> &CallSites,
- const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
- const SmallVectorImpl<unsigned> &FirstActions) override;
-};
-
-} // End of namespace llvm
-
-#endif
OpenPOWER on IntegriCloud