summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-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
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp45
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp10
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp83
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp4
-rw-r--r--llvm/lib/CodeGen/WasmEHPrepare.cpp2
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp6
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp4
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp15
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp7
16 files changed, 62 insertions, 264 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
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 9e4963c4bdb..431484f078b 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -661,11 +661,8 @@ MCSymbol *MachineFunction::addLandingPad(MachineBasicBlock *LandingPad) {
}
}
- } else if (const auto *CPI = dyn_cast<CatchPadInst>(FirstI)) {
- for (unsigned I = CPI->getNumArgOperands(); I != 0; --I) {
- Value *TypeInfo = CPI->getArgOperand(I - 1)->stripPointerCasts();
- addCatchTypeInfo(LandingPad, dyn_cast<GlobalValue>(TypeInfo));
- }
+ } else if (isa<CatchPadInst>(FirstI)) {
+ // TODO
} else {
assert(isa<CleanupPadInst>(FirstI) && "Invalid landingpad!");
@@ -690,8 +687,7 @@ void MachineFunction::addFilterTypeInfo(MachineBasicBlock *LandingPad,
LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));
}
-void MachineFunction::tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap,
- bool TidyIfNoBeginLabels) {
+void MachineFunction::tidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {
for (unsigned i = 0; i != LandingPads.size(); ) {
LandingPadInfo &LandingPad = LandingPads[i];
if (LandingPad.LandingPadLabel &&
@@ -706,25 +702,24 @@ void MachineFunction::tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap,
continue;
}
- if (TidyIfNoBeginLabels) {
- for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
- MCSymbol *BeginLabel = LandingPad.BeginLabels[j];
- MCSymbol *EndLabel = LandingPad.EndLabels[j];
- if ((BeginLabel->isDefined() || (LPMap && (*LPMap)[BeginLabel] != 0)) &&
- (EndLabel->isDefined() || (LPMap && (*LPMap)[EndLabel] != 0)))
- continue;
-
- LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
- LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
- --j;
- --e;
- }
+ for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
+ MCSymbol *BeginLabel = LandingPad.BeginLabels[j];
+ MCSymbol *EndLabel = LandingPad.EndLabels[j];
+ if ((BeginLabel->isDefined() ||
+ (LPMap && (*LPMap)[BeginLabel] != 0)) &&
+ (EndLabel->isDefined() ||
+ (LPMap && (*LPMap)[EndLabel] != 0))) continue;
+
+ LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
+ LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
+ --j;
+ --e;
+ }
- // Remove landing pads with no try-ranges.
- if (LandingPads[i].BeginLabels.empty()) {
- LandingPads.erase(LandingPads.begin() + i);
- continue;
- }
+ // Remove landing pads with no try-ranges.
+ if (LandingPads[i].BeginLabels.empty()) {
+ LandingPads.erase(LandingPads.begin() + i);
+ continue;
}
// If there is no landing pad, ensure that the list of typeids is empty.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 2e0456edef7..be4a219efe5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6288,12 +6288,12 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
return nullptr;
}
- case Intrinsic::wasm_landingpad_index:
- // Information this intrinsic contained has been transferred to
- // MachineFunction in SelectionDAGISel::PrepareEHLandingPad. We can safely
- // delete it now.
+ case Intrinsic::wasm_landingpad_index: {
+ // TODO store landing pad index in a map, which will be used when generating
+ // LSDA information
return nullptr;
}
+ }
}
void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
@@ -6450,7 +6450,7 @@ SelectionDAGBuilder::lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
WinEHFuncInfo *EHInfo = DAG.getMachineFunction().getWinEHFuncInfo();
EHInfo->addIPToStateRange(cast<InvokeInst>(CLI.CS.getInstruction()),
BeginLabel, EndLabel);
- } else if (!isScopedEHPersonality(Pers)) {
+ } else {
MF.addInvoke(FuncInfo.MBBMap[EHPadBB], BeginLabel, EndLabel);
}
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 90bcaa653c3..2b4a590f19f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -27,7 +27,6 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
-#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
@@ -1129,36 +1128,6 @@ static bool hasExceptionPointerOrCodeUser(const CatchPadInst *CPI) {
return false;
}
-// wasm.landingpad.index intrinsic is for associating a landing pad index number
-// with a catchpad instruction. Retrieve the landing pad index in the intrinsic
-// and store the mapping in the function.
-static void mapWasmLandingPadIndex(MachineBasicBlock *MBB,
- const CatchPadInst *CPI) {
- MachineFunction *MF = MBB->getParent();
- // In case of single catch (...), we don't emit LSDA, so we don't need
- // this information.
- bool IsSingleCatchAllClause =
- CPI->getNumArgOperands() == 1 &&
- cast<Constant>(CPI->getArgOperand(0))->isNullValue();
- if (!IsSingleCatchAllClause) {
- // Create a mapping from landing pad label to landing pad index.
- bool IntrFound = false;
- for (const User *U : CPI->users()) {
- if (const auto *Call = dyn_cast<IntrinsicInst>(U)) {
- Intrinsic::ID IID = Call->getIntrinsicID();
- if (IID == Intrinsic::wasm_landingpad_index) {
- Value *IndexArg = Call->getArgOperand(1);
- int Index = cast<ConstantInt>(IndexArg)->getZExtValue();
- MF->setWasmLandingPadIndex(MBB, Index);
- IntrFound = true;
- break;
- }
- }
- }
- assert(IntrFound && "wasm.landingpad.index intrinsic not found!");
- }
-}
-
/// PrepareEHLandingPad - Emit an EH_LABEL, set up live-in registers, and
/// do other setup for EH landing-pad blocks.
bool SelectionDAGISel::PrepareEHLandingPad() {
@@ -1168,48 +1137,44 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
const TargetRegisterClass *PtrRC =
TLI->getRegClassFor(TLI->getPointerTy(CurDAG->getDataLayout()));
- auto Pers = classifyEHPersonality(PersonalityFn);
-
// Catchpads have one live-in register, which typically holds the exception
// pointer or code.
- if (isFuncletEHPersonality(Pers)) {
- if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) {
- if (hasExceptionPointerOrCodeUser(CPI)) {
- // Get or create the virtual register to hold the pointer or code. Mark
- // the live in physreg and copy into the vreg.
- MCPhysReg EHPhysReg = TLI->getExceptionPointerRegister(PersonalityFn);
- assert(EHPhysReg && "target lacks exception pointer register");
- MBB->addLiveIn(EHPhysReg);
- unsigned VReg = FuncInfo->getCatchPadExceptionPointerVReg(CPI, PtrRC);
- BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(),
- TII->get(TargetOpcode::COPY), VReg)
- .addReg(EHPhysReg, RegState::Kill);
- }
+ if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) {
+ if (hasExceptionPointerOrCodeUser(CPI)) {
+ // Get or create the virtual register to hold the pointer or code. Mark
+ // the live in physreg and copy into the vreg.
+ MCPhysReg EHPhysReg = TLI->getExceptionPointerRegister(PersonalityFn);
+ assert(EHPhysReg && "target lacks exception pointer register");
+ MBB->addLiveIn(EHPhysReg);
+ unsigned VReg = FuncInfo->getCatchPadExceptionPointerVReg(CPI, PtrRC);
+ BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(),
+ TII->get(TargetOpcode::COPY), VReg)
+ .addReg(EHPhysReg, RegState::Kill);
}
return true;
}
+ if (!LLVMBB->isLandingPad())
+ return true;
+
// Add a label to mark the beginning of the landing pad. Deletion of the
// landing pad can thus be detected via the MachineModuleInfo.
MCSymbol *Label = MF->addLandingPad(MBB);
+ // Assign the call site to the landing pad's begin label.
+ MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]);
+
const MCInstrDesc &II = TII->get(TargetOpcode::EH_LABEL);
BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), II)
.addSym(Label);
- if (Pers == EHPersonality::Wasm_CXX) {
- if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI()))
- mapWasmLandingPadIndex(MBB, CPI);
- } else {
- // Assign the call site to the landing pad's begin label.
- MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]);
- // Mark exception register as live in.
- if (unsigned Reg = TLI->getExceptionPointerRegister(PersonalityFn))
- FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC);
- // Mark exception selector register as live in.
- if (unsigned Reg = TLI->getExceptionSelectorRegister(PersonalityFn))
- FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC);
- }
+ // Mark exception register as live in.
+ if (unsigned Reg = TLI->getExceptionPointerRegister(PersonalityFn))
+ FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC);
+
+ // Mark exception selector register as live in.
+ if (unsigned Reg = TLI->getExceptionSelectorRegister(PersonalityFn))
+ FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC);
return true;
}
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 341ab927861..b046cd81d6c 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1748,10 +1748,6 @@ const MCExpr *TargetLoweringObjectFileWasm::lowerRelativeReference(
void TargetLoweringObjectFileWasm::InitializeWasm() {
StaticCtorSection =
getContext().getWasmSection(".init_array", SectionKind::getData());
-
- // We don't use PersonalityEncoding and LSDAEncoding because we don't emit
- // .cfi directives. We use TTypeEncoding to encode typeinfo global variables.
- TTypeEncoding = dwarf::DW_EH_PE_absptr;
}
MCSection *TargetLoweringObjectFileWasm::getStaticCtorSection(
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 6f02a05f561..83d04da5dd0 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -300,7 +300,7 @@ void WasmEHPrepare::prepareEHPad(BasicBlock *BB, unsigned Index) {
// This is to create a map of <landingpad EH label, landingpad index> in
// SelectionDAGISel, which is to be used in EHStreamer to emit LSDA tables.
// Pseudocode: wasm.landingpad.index(Index);
- IRB.CreateCall(LPadIndexF, {FPI, IRB.getInt32(Index)});
+ IRB.CreateCall(LPadIndexF, IRB.getInt32(Index));
// Pseudocode: __wasm_lpad_context.lpad_index = index;
IRB.CreateStore(IRB.getInt32(Index), LPadIndexField);
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index b1e03f8efee..edfccfcb9ed 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -743,12 +743,6 @@ void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
- // Wasm use data section for LSDA.
- // TODO Consider putting each function's exception table in a separate
- // section, as in -function-sections, to facilitate lld's --gc-section.
- LSDASection = Ctx->getWasmSection(".rodata.gcc_except_table",
- SectionKind::getReadOnlyWithRel());
-
// TODO: Define more sections.
}
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index f9318ad5801..cbbe161ae82 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -635,12 +635,10 @@ static void addData(SmallVectorImpl<char> &DataBytes,
llvm_unreachable("The fill should be an assembler constant");
DataBytes.insert(DataBytes.end(), Fill->getValueSize() * NumValues,
Fill->getValue());
- } else if (auto *LEB = dyn_cast<MCLEBFragment>(&Frag)) {
- const SmallVectorImpl<char> &Contents = LEB->getContents();
- DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end());
} else {
const auto &DataFrag = cast<MCDataFragment>(Frag);
const SmallVectorImpl<char> &Contents = DataFrag.getContents();
+
DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end());
}
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 080bfe771a4..30c2e843408 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -21,7 +21,6 @@
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
-#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/IR/DiagnosticInfo.h"
@@ -967,17 +966,9 @@ WebAssemblyTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
default:
return {}; // Don't custom lower most intrinsics.
- case Intrinsic::wasm_lsda: {
- MachineFunction &MF = DAG.getMachineFunction();
- EVT VT = Op.getValueType();
- const TargetLowering &TLI = DAG.getTargetLoweringInfo();
- MVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
- auto &Context = MF.getMMI().getContext();
- MCSymbol *S = Context.getOrCreateSymbol(Twine("GCC_except_table") +
- Twine(MF.getFunctionNumber()));
- return DAG.getNode(WebAssemblyISD::Wrapper, DL, VT,
- DAG.getMCSymbol(S, PtrVT));
- }
+ case Intrinsic::wasm_lsda:
+ // TODO For now, just return 0 not to crash
+ return DAG.getConstant(0, DL, Op.getValueType());
}
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
index 4acad5f5943..8d98510c67d 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
@@ -269,8 +269,6 @@ def : Pat<(i32 (WebAssemblywrapper tglobaladdr:$addr)),
(CONST_I32 tglobaladdr:$addr)>;
def : Pat<(i32 (WebAssemblywrapper texternalsym:$addr)),
(CONST_I32 texternalsym:$addr)>;
-def : Pat<(i32 (WebAssemblywrapper mcsym:$sym)), (CONST_I32 mcsym:$sym)>;
-def : Pat<(i64 (WebAssemblywrapper mcsym:$sym)), (CONST_I64 mcsym:$sym)>;
//===----------------------------------------------------------------------===//
// Additional sets of instructions.
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index 15b3da4c8b8..e9a0cf51905 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -226,13 +226,6 @@ void WebAssemblyMCInstLower::Lower(const MachineInstr *MI,
(MO.getTargetFlags() & WebAssemblyII::MO_SYMBOL_FUNCTION) != 0,
(MO.getTargetFlags() & WebAssemblyII::MO_SYMBOL_GLOBAL) != 0);
break;
- case MachineOperand::MO_MCSymbol:
- // This is currently used only for LSDA symbols (GCC_except_table),
- // because global addresses or other external symbols are handled above.
- assert(MO.getTargetFlags() == 0 &&
- "WebAssembly does not use target flags on MCSymbol");
- MCOp = LowerSymbolOperand(MO.getMCSymbol(), /*Offset=*/0, false, false);
- break;
}
OutMI.addOperand(MCOp);
OpenPOWER on IntegriCloud