1 //===-- WebAssembly.h - Top-level interface for WebAssembly ----*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// 9 /// \file 10 /// This file contains the entry points for global functions defined in 11 /// the LLVM WebAssembly back-end. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H 16 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H 17 18 #include "llvm/PassRegistry.h" 19 #include "llvm/Support/CodeGen.h" 20 21 namespace llvm { 22 23 class WebAssemblyTargetMachine; 24 class ModulePass; 25 class FunctionPass; 26 27 // LLVM IR passes. 28 ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj); 29 ModulePass *createWebAssemblyLowerGlobalDtors(); 30 ModulePass *createWebAssemblyAddMissingPrototypes(); 31 ModulePass *createWebAssemblyFixFunctionBitcasts(); 32 FunctionPass *createWebAssemblyOptimizeReturned(); 33 34 // ISel and immediate followup passes. 35 FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, 36 CodeGenOpt::Level OptLevel); 37 FunctionPass *createWebAssemblyArgumentMove(); 38 FunctionPass *createWebAssemblySetP2AlignOperands(); 39 40 // Late passes. 41 FunctionPass *createWebAssemblyReplacePhysRegs(); 42 FunctionPass *createWebAssemblyPrepareForLiveIntervals(); 43 FunctionPass *createWebAssemblyOptimizeLiveIntervals(); 44 FunctionPass *createWebAssemblyMemIntrinsicResults(); 45 FunctionPass *createWebAssemblyRegStackify(); 46 FunctionPass *createWebAssemblyRegColoring(); 47 FunctionPass *createWebAssemblyFixIrreducibleControlFlow(); 48 FunctionPass *createWebAssemblyLateEHPrepare(); 49 FunctionPass *createWebAssemblyCFGSort(); 50 FunctionPass *createWebAssemblyCFGStackify(); 51 FunctionPass *createWebAssemblyExplicitLocals(); 52 FunctionPass *createWebAssemblyLowerBrUnless(); 53 FunctionPass *createWebAssemblyRegNumbering(); 54 FunctionPass *createWebAssemblyPeephole(); 55 FunctionPass *createWebAssemblyCallIndirectFixup(); 56 57 // PassRegistry initialization declarations. 58 void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &); 59 void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &); 60 void initializeLowerGlobalDtorsPass(PassRegistry &); 61 void initializeFixFunctionBitcastsPass(PassRegistry &); 62 void initializeOptimizeReturnedPass(PassRegistry &); 63 void initializeWebAssemblyArgumentMovePass(PassRegistry &); 64 void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); 65 void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); 66 void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &); 67 void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); 68 void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &); 69 void initializeWebAssemblyRegStackifyPass(PassRegistry &); 70 void initializeWebAssemblyRegColoringPass(PassRegistry &); 71 void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &); 72 void initializeWebAssemblyLateEHPreparePass(PassRegistry &); 73 void initializeWebAssemblyExceptionInfoPass(PassRegistry &); 74 void initializeWebAssemblyCFGSortPass(PassRegistry &); 75 void initializeWebAssemblyCFGStackifyPass(PassRegistry &); 76 void initializeWebAssemblyExplicitLocalsPass(PassRegistry &); 77 void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &); 78 void initializeWebAssemblyRegNumberingPass(PassRegistry &); 79 void initializeWebAssemblyPeepholePass(PassRegistry &); 80 void initializeWebAssemblyCallIndirectFixupPass(PassRegistry &); 81 82 namespace WebAssembly { 83 enum TargetIndex { TI_LOCAL_START, TI_GLOBAL_START, TI_OPERAND_STACK_START }; 84 } // end namespace WebAssembly 85 86 } // end namespace llvm 87 88 #endif 89