10b57cec5SDimitry Andric //===-- WebAssembly.h - Top-level interface for WebAssembly ----*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric /// 90b57cec5SDimitry Andric /// \file 100b57cec5SDimitry Andric /// This file contains the entry points for global functions defined in 110b57cec5SDimitry Andric /// the LLVM WebAssembly back-end. 120b57cec5SDimitry Andric /// 130b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H 160b57cec5SDimitry Andric #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric #include "llvm/PassRegistry.h" 190b57cec5SDimitry Andric #include "llvm/Support/CodeGen.h" 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric namespace llvm { 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric class WebAssemblyTargetMachine; 240b57cec5SDimitry Andric class ModulePass; 250b57cec5SDimitry Andric class FunctionPass; 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric // LLVM IR passes. 28349cc55cSDimitry Andric ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(); 290b57cec5SDimitry Andric ModulePass *createWebAssemblyAddMissingPrototypes(); 300b57cec5SDimitry Andric ModulePass *createWebAssemblyFixFunctionBitcasts(); 310b57cec5SDimitry Andric FunctionPass *createWebAssemblyOptimizeReturned(); 32349cc55cSDimitry Andric FunctionPass *createWebAssemblyLowerRefTypesIntPtrConv(); 33*0fca6ea1SDimitry Andric FunctionPass *createWebAssemblyRefTypeMem2Local(); 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric // ISel and immediate followup passes. 360b57cec5SDimitry Andric FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, 375f757f3fSDimitry Andric CodeGenOptLevel OptLevel); 380b57cec5SDimitry Andric FunctionPass *createWebAssemblyArgumentMove(); 390b57cec5SDimitry Andric FunctionPass *createWebAssemblySetP2AlignOperands(); 40*0fca6ea1SDimitry Andric FunctionPass *createWebAssemblyCleanCodeAfterTrap(); 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric // Late passes. 430b57cec5SDimitry Andric FunctionPass *createWebAssemblyReplacePhysRegs(); 44fe6060f1SDimitry Andric FunctionPass *createWebAssemblyNullifyDebugValueLists(); 450b57cec5SDimitry Andric FunctionPass *createWebAssemblyOptimizeLiveIntervals(); 460b57cec5SDimitry Andric FunctionPass *createWebAssemblyMemIntrinsicResults(); 470b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegStackify(); 480b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegColoring(); 495ffd83dbSDimitry Andric FunctionPass *createWebAssemblyFixBrTableDefaults(); 500b57cec5SDimitry Andric FunctionPass *createWebAssemblyFixIrreducibleControlFlow(); 510b57cec5SDimitry Andric FunctionPass *createWebAssemblyLateEHPrepare(); 520b57cec5SDimitry Andric FunctionPass *createWebAssemblyCFGSort(); 530b57cec5SDimitry Andric FunctionPass *createWebAssemblyCFGStackify(); 540b57cec5SDimitry Andric FunctionPass *createWebAssemblyExplicitLocals(); 550b57cec5SDimitry Andric FunctionPass *createWebAssemblyLowerBrUnless(); 560b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegNumbering(); 575ffd83dbSDimitry Andric FunctionPass *createWebAssemblyDebugFixup(); 580b57cec5SDimitry Andric FunctionPass *createWebAssemblyPeephole(); 59349cc55cSDimitry Andric ModulePass *createWebAssemblyMCLowerPrePass(); 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric // PassRegistry initialization declarations. 620b57cec5SDimitry Andric void initializeFixFunctionBitcastsPass(PassRegistry &); 630b57cec5SDimitry Andric void initializeOptimizeReturnedPass(PassRegistry &); 64*0fca6ea1SDimitry Andric void initializeWebAssemblyRefTypeMem2LocalPass(PassRegistry &); 65bdd1243dSDimitry Andric void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &); 660b57cec5SDimitry Andric void initializeWebAssemblyArgumentMovePass(PassRegistry &); 67*0fca6ea1SDimitry Andric void initializeWebAssemblyCleanCodeAfterTrapPass(PassRegistry &); 68bdd1243dSDimitry Andric void initializeWebAssemblyCFGSortPass(PassRegistry &); 69bdd1243dSDimitry Andric void initializeWebAssemblyCFGStackifyPass(PassRegistry &); 70*0fca6ea1SDimitry Andric void initializeWebAssemblyDAGToDAGISelLegacyPass(PassRegistry &); 71bdd1243dSDimitry Andric void initializeWebAssemblyDebugFixupPass(PassRegistry &); 72bdd1243dSDimitry Andric void initializeWebAssemblyExceptionInfoPass(PassRegistry &); 73bdd1243dSDimitry Andric void initializeWebAssemblyExplicitLocalsPass(PassRegistry &); 745ffd83dbSDimitry Andric void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &); 750b57cec5SDimitry Andric void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &); 760b57cec5SDimitry Andric void initializeWebAssemblyLateEHPreparePass(PassRegistry &); 770b57cec5SDimitry Andric void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &); 78bdd1243dSDimitry Andric void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &); 79349cc55cSDimitry Andric void initializeWebAssemblyLowerRefTypesIntPtrConvPass(PassRegistry &); 80bdd1243dSDimitry Andric void initializeWebAssemblyMCLowerPrePassPass(PassRegistry &); 81bdd1243dSDimitry Andric void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &); 82bdd1243dSDimitry Andric void initializeWebAssemblyNullifyDebugValueListsPass(PassRegistry &); 83bdd1243dSDimitry Andric void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); 84bdd1243dSDimitry Andric void initializeWebAssemblyPeepholePass(PassRegistry &); 85bdd1243dSDimitry Andric void initializeWebAssemblyRegColoringPass(PassRegistry &); 86bdd1243dSDimitry Andric void initializeWebAssemblyRegNumberingPass(PassRegistry &); 87bdd1243dSDimitry Andric void initializeWebAssemblyRegStackifyPass(PassRegistry &); 88bdd1243dSDimitry Andric void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); 89bdd1243dSDimitry Andric void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); 900b57cec5SDimitry Andric 91480093f4SDimitry Andric namespace WebAssembly { 925ffd83dbSDimitry Andric enum TargetIndex { 935ffd83dbSDimitry Andric // Followed by a local index (ULEB). 945ffd83dbSDimitry Andric TI_LOCAL, 955ffd83dbSDimitry Andric // Followed by an absolute global index (ULEB). DEPRECATED. 965ffd83dbSDimitry Andric TI_GLOBAL_FIXED, 97fe6060f1SDimitry Andric // Followed by the index from the bottom of the Wasm stack. 985ffd83dbSDimitry Andric TI_OPERAND_STACK, 995ffd83dbSDimitry Andric // Followed by a compilation unit relative global index (uint32_t) 1005ffd83dbSDimitry Andric // that will have an associated relocation. 101fe6060f1SDimitry Andric TI_GLOBAL_RELOC, 102fe6060f1SDimitry Andric // Like TI_LOCAL, but indicates an indirect value (e.g. byval arg 103fe6060f1SDimitry Andric // passed by pointer). 104fe6060f1SDimitry Andric TI_LOCAL_INDIRECT 1055ffd83dbSDimitry Andric }; 106480093f4SDimitry Andric } // end namespace WebAssembly 107480093f4SDimitry Andric 1080b57cec5SDimitry Andric } // end namespace llvm 1090b57cec5SDimitry Andric 1100b57cec5SDimitry Andric #endif 111