| 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(); |
| 29 | ModulePass *createWebAssemblyAddMissingPrototypes(); |
| 30 | ModulePass *createWebAssemblyFixFunctionBitcasts(); |
| 31 | FunctionPass *createWebAssemblyOptimizeReturned(); |
| 32 | FunctionPass *createWebAssemblyLowerRefTypesIntPtrConv(); |
| 33 | FunctionPass *createWebAssemblyRefTypeMem2Local(); |
| 34 | |
| 35 | // ISel and immediate followup passes. |
| 36 | FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, |
| 37 | CodeGenOptLevel OptLevel); |
| 38 | FunctionPass *createWebAssemblyArgumentMove(); |
| 39 | FunctionPass *createWebAssemblySetP2AlignOperands(); |
| 40 | FunctionPass *createWebAssemblyCleanCodeAfterTrap(); |
| 41 | |
| 42 | // Late passes. |
| 43 | FunctionPass *createWebAssemblyReplacePhysRegs(); |
| 44 | FunctionPass *createWebAssemblyNullifyDebugValueLists(); |
| 45 | FunctionPass *createWebAssemblyOptimizeLiveIntervals(); |
| 46 | FunctionPass *createWebAssemblyMemIntrinsicResults(); |
| 47 | FunctionPass *createWebAssemblyRegStackify(CodeGenOptLevel OptLevel); |
| 48 | FunctionPass *createWebAssemblyRegColoring(); |
| 49 | FunctionPass *createWebAssemblyFixBrTableDefaults(); |
| 50 | FunctionPass *createWebAssemblyFixIrreducibleControlFlow(); |
| 51 | FunctionPass *createWebAssemblyLateEHPrepare(); |
| 52 | FunctionPass *createWebAssemblyCFGSort(); |
| 53 | FunctionPass *createWebAssemblyCFGStackify(); |
| 54 | FunctionPass *createWebAssemblyExplicitLocals(); |
| 55 | FunctionPass *createWebAssemblyLowerBrUnless(); |
| 56 | FunctionPass *createWebAssemblyRegNumbering(); |
| 57 | FunctionPass *createWebAssemblyDebugFixup(); |
| 58 | FunctionPass *createWebAssemblyPeephole(); |
| 59 | ModulePass *createWebAssemblyMCLowerPrePass(); |
| 60 | |
| 61 | // PassRegistry initialization declarations. |
| 62 | void initializeFixFunctionBitcastsPass(PassRegistry &); |
| 63 | void initializeOptimizeReturnedPass(PassRegistry &); |
| 64 | void initializeWebAssemblyRefTypeMem2LocalPass(PassRegistry &); |
| 65 | void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &); |
| 66 | void initializeWebAssemblyArgumentMovePass(PassRegistry &); |
| 67 | void initializeWebAssemblyAsmPrinterPass(PassRegistry &); |
| 68 | void initializeWebAssemblyCleanCodeAfterTrapPass(PassRegistry &); |
| 69 | void initializeWebAssemblyCFGSortPass(PassRegistry &); |
| 70 | void initializeWebAssemblyCFGStackifyPass(PassRegistry &); |
| 71 | void initializeWebAssemblyDAGToDAGISelLegacyPass(PassRegistry &); |
| 72 | void initializeWebAssemblyDebugFixupPass(PassRegistry &); |
| 73 | void initializeWebAssemblyExceptionInfoPass(PassRegistry &); |
| 74 | void initializeWebAssemblyExplicitLocalsPass(PassRegistry &); |
| 75 | void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &); |
| 76 | void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &); |
| 77 | void initializeWebAssemblyLateEHPreparePass(PassRegistry &); |
| 78 | void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &); |
| 79 | void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &); |
| 80 | void initializeWebAssemblyLowerRefTypesIntPtrConvPass(PassRegistry &); |
| 81 | void initializeWebAssemblyMCLowerPrePassPass(PassRegistry &); |
| 82 | void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &); |
| 83 | void initializeWebAssemblyNullifyDebugValueListsPass(PassRegistry &); |
| 84 | void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); |
| 85 | void initializeWebAssemblyPeepholePass(PassRegistry &); |
| 86 | void initializeWebAssemblyRegColoringPass(PassRegistry &); |
| 87 | void initializeWebAssemblyRegNumberingPass(PassRegistry &); |
| 88 | void initializeWebAssemblyRegStackifyPass(PassRegistry &); |
| 89 | void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); |
| 90 | void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); |
| 91 | |
| 92 | namespace WebAssembly { |
| 93 | enum TargetIndex { |
| 94 | // Followed by a local index (ULEB). |
| 95 | TI_LOCAL, |
| 96 | // Followed by an absolute global index (ULEB). DEPRECATED. |
| 97 | TI_GLOBAL_FIXED, |
| 98 | // Followed by the index from the bottom of the Wasm stack. |
| 99 | TI_OPERAND_STACK, |
| 100 | // Followed by a compilation unit relative global index (uint32_t) |
| 101 | // that will have an associated relocation. |
| 102 | TI_GLOBAL_RELOC, |
| 103 | // Like TI_LOCAL, but indicates an indirect value (e.g. byval arg |
| 104 | // passed by pointer). |
| 105 | TI_LOCAL_INDIRECT |
| 106 | }; |
| 107 | } // end namespace WebAssembly |
| 108 | |
| 109 | } // end namespace llvm |
| 110 | |
| 111 | #endif |
| 112 | |