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. 28*349cc55cSDimitry Andric ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(); 290b57cec5SDimitry Andric ModulePass *createWebAssemblyLowerGlobalDtors(); 300b57cec5SDimitry Andric ModulePass *createWebAssemblyAddMissingPrototypes(); 310b57cec5SDimitry Andric ModulePass *createWebAssemblyFixFunctionBitcasts(); 320b57cec5SDimitry Andric FunctionPass *createWebAssemblyOptimizeReturned(); 33*349cc55cSDimitry Andric FunctionPass *createWebAssemblyLowerRefTypesIntPtrConv(); 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric // ISel and immediate followup passes. 360b57cec5SDimitry Andric FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, 370b57cec5SDimitry Andric CodeGenOpt::Level OptLevel); 380b57cec5SDimitry Andric FunctionPass *createWebAssemblyArgumentMove(); 390b57cec5SDimitry Andric FunctionPass *createWebAssemblySetP2AlignOperands(); 400b57cec5SDimitry Andric 410b57cec5SDimitry Andric // Late passes. 420b57cec5SDimitry Andric FunctionPass *createWebAssemblyReplacePhysRegs(); 43fe6060f1SDimitry Andric FunctionPass *createWebAssemblyNullifyDebugValueLists(); 440b57cec5SDimitry Andric FunctionPass *createWebAssemblyPrepareForLiveIntervals(); 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(); 59*349cc55cSDimitry Andric ModulePass *createWebAssemblyMCLowerPrePass(); 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric // PassRegistry initialization declarations. 620b57cec5SDimitry Andric void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &); 630b57cec5SDimitry Andric void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &); 640b57cec5SDimitry Andric void initializeLowerGlobalDtorsPass(PassRegistry &); 650b57cec5SDimitry Andric void initializeFixFunctionBitcastsPass(PassRegistry &); 660b57cec5SDimitry Andric void initializeOptimizeReturnedPass(PassRegistry &); 670b57cec5SDimitry Andric void initializeWebAssemblyArgumentMovePass(PassRegistry &); 680b57cec5SDimitry Andric void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); 690b57cec5SDimitry Andric void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); 70fe6060f1SDimitry Andric void initializeWebAssemblyNullifyDebugValueListsPass(PassRegistry &); 710b57cec5SDimitry Andric void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &); 720b57cec5SDimitry Andric void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); 730b57cec5SDimitry Andric void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &); 740b57cec5SDimitry Andric void initializeWebAssemblyRegStackifyPass(PassRegistry &); 750b57cec5SDimitry Andric void initializeWebAssemblyRegColoringPass(PassRegistry &); 765ffd83dbSDimitry Andric void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &); 770b57cec5SDimitry Andric void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &); 780b57cec5SDimitry Andric void initializeWebAssemblyLateEHPreparePass(PassRegistry &); 790b57cec5SDimitry Andric void initializeWebAssemblyExceptionInfoPass(PassRegistry &); 800b57cec5SDimitry Andric void initializeWebAssemblyCFGSortPass(PassRegistry &); 810b57cec5SDimitry Andric void initializeWebAssemblyCFGStackifyPass(PassRegistry &); 820b57cec5SDimitry Andric void initializeWebAssemblyExplicitLocalsPass(PassRegistry &); 830b57cec5SDimitry Andric void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &); 840b57cec5SDimitry Andric void initializeWebAssemblyRegNumberingPass(PassRegistry &); 855ffd83dbSDimitry Andric void initializeWebAssemblyDebugFixupPass(PassRegistry &); 860b57cec5SDimitry Andric void initializeWebAssemblyPeepholePass(PassRegistry &); 87fe6060f1SDimitry Andric void initializeWebAssemblyMCLowerPrePassPass(PassRegistry &); 88*349cc55cSDimitry Andric void initializeWebAssemblyLowerRefTypesIntPtrConvPass(PassRegistry &); 890b57cec5SDimitry Andric 90480093f4SDimitry Andric namespace WebAssembly { 915ffd83dbSDimitry Andric enum TargetIndex { 925ffd83dbSDimitry Andric // Followed by a local index (ULEB). 935ffd83dbSDimitry Andric TI_LOCAL, 945ffd83dbSDimitry Andric // Followed by an absolute global index (ULEB). DEPRECATED. 955ffd83dbSDimitry Andric TI_GLOBAL_FIXED, 96fe6060f1SDimitry Andric // Followed by the index from the bottom of the Wasm stack. 975ffd83dbSDimitry Andric TI_OPERAND_STACK, 985ffd83dbSDimitry Andric // Followed by a compilation unit relative global index (uint32_t) 995ffd83dbSDimitry Andric // that will have an associated relocation. 100fe6060f1SDimitry Andric TI_GLOBAL_RELOC, 101fe6060f1SDimitry Andric // Like TI_LOCAL, but indicates an indirect value (e.g. byval arg 102fe6060f1SDimitry Andric // passed by pointer). 103fe6060f1SDimitry Andric TI_LOCAL_INDIRECT 1045ffd83dbSDimitry Andric }; 105480093f4SDimitry Andric } // end namespace WebAssembly 106480093f4SDimitry Andric 1070b57cec5SDimitry Andric } // end namespace llvm 1080b57cec5SDimitry Andric 1090b57cec5SDimitry Andric #endif 110