mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-14 17:36:29 +00:00

Summary: After the staack is unwound due to a thrown exxception, `__stack_pointer` global can point to an invalid address. So a `global.set` to restore `__stack_pointer` should be inserted right after `catch` instruction. But after r352598 the `global.set` instruction is inserted not right after `catch` but after `block` - `br-on-exn` - `end_block` - `extract_exception` sequence. This CL fixes it. While doing that, we can actually move ReplacePhysRegs pass after LateEHPrepare and merge EHRestoreStackPointer pass into LateEHPrepare, and now placing `global.set` to `__stack_pointer` right after `catch` is much easier. Otherwise it is hard to guarantee that `global.set` is still right after `catch` and not touched with other transformations, in which case we have to do something to hoist it. Reviewers: dschuff Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57421 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352681 91177308-0d34-0410-b5e6-96231b3b80d8
85 lines
3.6 KiB
C++
85 lines
3.6 KiB
C++
//===-- WebAssembly.h - Top-level interface for WebAssembly ----*- C++ -*-===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file contains the entry points for global functions defined in
|
|
/// the LLVM WebAssembly back-end.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
|
|
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
|
|
|
|
#include "llvm/PassRegistry.h"
|
|
#include "llvm/Support/CodeGen.h"
|
|
|
|
namespace llvm {
|
|
|
|
class WebAssemblyTargetMachine;
|
|
class ModulePass;
|
|
class FunctionPass;
|
|
|
|
// LLVM IR passes.
|
|
ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj);
|
|
ModulePass *createWebAssemblyLowerGlobalDtors();
|
|
ModulePass *createWebAssemblyAddMissingPrototypes();
|
|
ModulePass *createWebAssemblyFixFunctionBitcasts();
|
|
FunctionPass *createWebAssemblyOptimizeReturned();
|
|
|
|
// ISel and immediate followup passes.
|
|
FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM,
|
|
CodeGenOpt::Level OptLevel);
|
|
FunctionPass *createWebAssemblyArgumentMove();
|
|
FunctionPass *createWebAssemblySetP2AlignOperands();
|
|
|
|
// Late passes.
|
|
FunctionPass *createWebAssemblyReplacePhysRegs();
|
|
FunctionPass *createWebAssemblyPrepareForLiveIntervals();
|
|
FunctionPass *createWebAssemblyOptimizeLiveIntervals();
|
|
FunctionPass *createWebAssemblyMemIntrinsicResults();
|
|
FunctionPass *createWebAssemblyRegStackify();
|
|
FunctionPass *createWebAssemblyRegColoring();
|
|
FunctionPass *createWebAssemblyExplicitLocals();
|
|
FunctionPass *createWebAssemblyFixIrreducibleControlFlow();
|
|
FunctionPass *createWebAssemblyLateEHPrepare();
|
|
FunctionPass *createWebAssemblyCFGSort();
|
|
FunctionPass *createWebAssemblyCFGStackify();
|
|
FunctionPass *createWebAssemblyLowerBrUnless();
|
|
FunctionPass *createWebAssemblyRegNumbering();
|
|
FunctionPass *createWebAssemblyPeephole();
|
|
FunctionPass *createWebAssemblyCallIndirectFixup();
|
|
|
|
// PassRegistry initialization declarations.
|
|
void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &);
|
|
void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &);
|
|
void initializeLowerGlobalDtorsPass(PassRegistry &);
|
|
void initializeFixFunctionBitcastsPass(PassRegistry &);
|
|
void initializeOptimizeReturnedPass(PassRegistry &);
|
|
void initializeWebAssemblyArgumentMovePass(PassRegistry &);
|
|
void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &);
|
|
void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &);
|
|
void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &);
|
|
void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &);
|
|
void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &);
|
|
void initializeWebAssemblyRegStackifyPass(PassRegistry &);
|
|
void initializeWebAssemblyRegColoringPass(PassRegistry &);
|
|
void initializeWebAssemblyExplicitLocalsPass(PassRegistry &);
|
|
void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &);
|
|
void initializeWebAssemblyLateEHPreparePass(PassRegistry &);
|
|
void initializeWebAssemblyExceptionInfoPass(PassRegistry &);
|
|
void initializeWebAssemblyCFGSortPass(PassRegistry &);
|
|
void initializeWebAssemblyCFGStackifyPass(PassRegistry &);
|
|
void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &);
|
|
void initializeWebAssemblyRegNumberingPass(PassRegistry &);
|
|
void initializeWebAssemblyPeepholePass(PassRegistry &);
|
|
void initializeWebAssemblyCallIndirectFixupPass(PassRegistry &);
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif
|