xref: /freebsd/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssembly.h (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
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.
280b57cec5SDimitry Andric ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj);
290b57cec5SDimitry Andric ModulePass *createWebAssemblyLowerGlobalDtors();
300b57cec5SDimitry Andric ModulePass *createWebAssemblyAddMissingPrototypes();
310b57cec5SDimitry Andric ModulePass *createWebAssemblyFixFunctionBitcasts();
320b57cec5SDimitry Andric FunctionPass *createWebAssemblyOptimizeReturned();
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric // ISel and immediate followup passes.
350b57cec5SDimitry Andric FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM,
360b57cec5SDimitry Andric                                        CodeGenOpt::Level OptLevel);
370b57cec5SDimitry Andric FunctionPass *createWebAssemblyArgumentMove();
380b57cec5SDimitry Andric FunctionPass *createWebAssemblySetP2AlignOperands();
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric // Late passes.
410b57cec5SDimitry Andric FunctionPass *createWebAssemblyReplacePhysRegs();
420b57cec5SDimitry Andric FunctionPass *createWebAssemblyPrepareForLiveIntervals();
430b57cec5SDimitry Andric FunctionPass *createWebAssemblyOptimizeLiveIntervals();
440b57cec5SDimitry Andric FunctionPass *createWebAssemblyMemIntrinsicResults();
450b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegStackify();
460b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegColoring();
47*5ffd83dbSDimitry Andric FunctionPass *createWebAssemblyFixBrTableDefaults();
480b57cec5SDimitry Andric FunctionPass *createWebAssemblyFixIrreducibleControlFlow();
490b57cec5SDimitry Andric FunctionPass *createWebAssemblyLateEHPrepare();
500b57cec5SDimitry Andric FunctionPass *createWebAssemblyCFGSort();
510b57cec5SDimitry Andric FunctionPass *createWebAssemblyCFGStackify();
520b57cec5SDimitry Andric FunctionPass *createWebAssemblyExplicitLocals();
530b57cec5SDimitry Andric FunctionPass *createWebAssemblyLowerBrUnless();
540b57cec5SDimitry Andric FunctionPass *createWebAssemblyRegNumbering();
55*5ffd83dbSDimitry Andric FunctionPass *createWebAssemblyDebugFixup();
560b57cec5SDimitry Andric FunctionPass *createWebAssemblyPeephole();
570b57cec5SDimitry Andric 
580b57cec5SDimitry Andric // PassRegistry initialization declarations.
590b57cec5SDimitry Andric void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &);
600b57cec5SDimitry Andric void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &);
610b57cec5SDimitry Andric void initializeLowerGlobalDtorsPass(PassRegistry &);
620b57cec5SDimitry Andric void initializeFixFunctionBitcastsPass(PassRegistry &);
630b57cec5SDimitry Andric void initializeOptimizeReturnedPass(PassRegistry &);
640b57cec5SDimitry Andric void initializeWebAssemblyArgumentMovePass(PassRegistry &);
650b57cec5SDimitry Andric void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &);
660b57cec5SDimitry Andric void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &);
670b57cec5SDimitry Andric void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &);
680b57cec5SDimitry Andric void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &);
690b57cec5SDimitry Andric void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &);
700b57cec5SDimitry Andric void initializeWebAssemblyRegStackifyPass(PassRegistry &);
710b57cec5SDimitry Andric void initializeWebAssemblyRegColoringPass(PassRegistry &);
72*5ffd83dbSDimitry Andric void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &);
730b57cec5SDimitry Andric void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &);
740b57cec5SDimitry Andric void initializeWebAssemblyLateEHPreparePass(PassRegistry &);
750b57cec5SDimitry Andric void initializeWebAssemblyExceptionInfoPass(PassRegistry &);
760b57cec5SDimitry Andric void initializeWebAssemblyCFGSortPass(PassRegistry &);
770b57cec5SDimitry Andric void initializeWebAssemblyCFGStackifyPass(PassRegistry &);
780b57cec5SDimitry Andric void initializeWebAssemblyExplicitLocalsPass(PassRegistry &);
790b57cec5SDimitry Andric void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &);
800b57cec5SDimitry Andric void initializeWebAssemblyRegNumberingPass(PassRegistry &);
81*5ffd83dbSDimitry Andric void initializeWebAssemblyDebugFixupPass(PassRegistry &);
820b57cec5SDimitry Andric void initializeWebAssemblyPeepholePass(PassRegistry &);
830b57cec5SDimitry Andric 
84480093f4SDimitry Andric namespace WebAssembly {
85*5ffd83dbSDimitry Andric enum TargetIndex {
86*5ffd83dbSDimitry Andric   // Followed by a local index (ULEB).
87*5ffd83dbSDimitry Andric   TI_LOCAL,
88*5ffd83dbSDimitry Andric   // Followed by an absolute global index (ULEB). DEPRECATED.
89*5ffd83dbSDimitry Andric   TI_GLOBAL_FIXED,
90*5ffd83dbSDimitry Andric   TI_OPERAND_STACK,
91*5ffd83dbSDimitry Andric   // Followed by a compilation unit relative global index (uint32_t)
92*5ffd83dbSDimitry Andric   // that will have an associated relocation.
93*5ffd83dbSDimitry Andric   TI_GLOBAL_RELOC
94*5ffd83dbSDimitry Andric };
95480093f4SDimitry Andric } // end namespace WebAssembly
96480093f4SDimitry Andric 
970b57cec5SDimitry Andric } // end namespace llvm
980b57cec5SDimitry Andric 
990b57cec5SDimitry Andric #endif
100