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