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 *createWebAssemblyFixBrTableDefaults(); 48 FunctionPass *createWebAssemblyFixIrreducibleControlFlow(); 49 FunctionPass *createWebAssemblyLateEHPrepare(); 50 FunctionPass *createWebAssemblyCFGSort(); 51 FunctionPass *createWebAssemblyCFGStackify(); 52 FunctionPass *createWebAssemblyExplicitLocals(); 53 FunctionPass *createWebAssemblyLowerBrUnless(); 54 FunctionPass *createWebAssemblyRegNumbering(); 55 FunctionPass *createWebAssemblyDebugFixup(); 56 FunctionPass *createWebAssemblyPeephole(); 57 58 // PassRegistry initialization declarations. 59 void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &); 60 void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &); 61 void initializeLowerGlobalDtorsPass(PassRegistry &); 62 void initializeFixFunctionBitcastsPass(PassRegistry &); 63 void initializeOptimizeReturnedPass(PassRegistry &); 64 void initializeWebAssemblyArgumentMovePass(PassRegistry &); 65 void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); 66 void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); 67 void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &); 68 void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); 69 void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &); 70 void initializeWebAssemblyRegStackifyPass(PassRegistry &); 71 void initializeWebAssemblyRegColoringPass(PassRegistry &); 72 void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &); 73 void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &); 74 void initializeWebAssemblyLateEHPreparePass(PassRegistry &); 75 void initializeWebAssemblyExceptionInfoPass(PassRegistry &); 76 void initializeWebAssemblyCFGSortPass(PassRegistry &); 77 void initializeWebAssemblyCFGStackifyPass(PassRegistry &); 78 void initializeWebAssemblyExplicitLocalsPass(PassRegistry &); 79 void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &); 80 void initializeWebAssemblyRegNumberingPass(PassRegistry &); 81 void initializeWebAssemblyDebugFixupPass(PassRegistry &); 82 void initializeWebAssemblyPeepholePass(PassRegistry &); 83 84 namespace WebAssembly { 85 enum TargetIndex { 86 // Followed by a local index (ULEB). 87 TI_LOCAL, 88 // Followed by an absolute global index (ULEB). DEPRECATED. 89 TI_GLOBAL_FIXED, 90 TI_OPERAND_STACK, 91 // Followed by a compilation unit relative global index (uint32_t) 92 // that will have an associated relocation. 93 TI_GLOBAL_RELOC 94 }; 95 } // end namespace WebAssembly 96 97 } // end namespace llvm 98 99 #endif 100