1 //===-- WebAssembly.h - Top-level interface for WebAssembly ----*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// This file contains the entry points for global functions defined in
11 /// the LLVM WebAssembly back-end.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
16 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
18 #include "llvm/PassRegistry.h"
19 #include "llvm/Support/CodeGen.h"
23 class WebAssemblyTargetMachine
;
28 ModulePass
*createWebAssemblyLowerEmscriptenEHSjLj(bool EnableEH
,
30 ModulePass
*createWebAssemblyLowerGlobalDtors();
31 ModulePass
*createWebAssemblyAddMissingPrototypes();
32 ModulePass
*createWebAssemblyFixFunctionBitcasts();
33 FunctionPass
*createWebAssemblyOptimizeReturned();
34 FunctionPass
*createWebAssemblyLowerRefTypesIntPtrConv();
36 // ISel and immediate followup passes.
37 FunctionPass
*createWebAssemblyISelDag(WebAssemblyTargetMachine
&TM
,
38 CodeGenOpt::Level OptLevel
);
39 FunctionPass
*createWebAssemblyArgumentMove();
40 FunctionPass
*createWebAssemblySetP2AlignOperands();
43 FunctionPass
*createWebAssemblyReplacePhysRegs();
44 FunctionPass
*createWebAssemblyNullifyDebugValueLists();
45 FunctionPass
*createWebAssemblyPrepareForLiveIntervals();
46 FunctionPass
*createWebAssemblyOptimizeLiveIntervals();
47 FunctionPass
*createWebAssemblyMemIntrinsicResults();
48 FunctionPass
*createWebAssemblyRegStackify();
49 FunctionPass
*createWebAssemblyRegColoring();
50 FunctionPass
*createWebAssemblyFixBrTableDefaults();
51 FunctionPass
*createWebAssemblyFixIrreducibleControlFlow();
52 FunctionPass
*createWebAssemblyLateEHPrepare();
53 FunctionPass
*createWebAssemblyCFGSort();
54 FunctionPass
*createWebAssemblyCFGStackify();
55 FunctionPass
*createWebAssemblyExplicitLocals();
56 FunctionPass
*createWebAssemblyLowerBrUnless();
57 FunctionPass
*createWebAssemblyRegNumbering();
58 FunctionPass
*createWebAssemblyDebugFixup();
59 FunctionPass
*createWebAssemblyPeephole();
60 FunctionPass
*createWebAssemblyMCLowerPrePass();
62 // PassRegistry initialization declarations.
63 void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry
&);
64 void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry
&);
65 void initializeLowerGlobalDtorsPass(PassRegistry
&);
66 void initializeFixFunctionBitcastsPass(PassRegistry
&);
67 void initializeOptimizeReturnedPass(PassRegistry
&);
68 void initializeWebAssemblyArgumentMovePass(PassRegistry
&);
69 void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry
&);
70 void initializeWebAssemblyReplacePhysRegsPass(PassRegistry
&);
71 void initializeWebAssemblyNullifyDebugValueListsPass(PassRegistry
&);
72 void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry
&);
73 void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry
&);
74 void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry
&);
75 void initializeWebAssemblyRegStackifyPass(PassRegistry
&);
76 void initializeWebAssemblyRegColoringPass(PassRegistry
&);
77 void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry
&);
78 void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry
&);
79 void initializeWebAssemblyLateEHPreparePass(PassRegistry
&);
80 void initializeWebAssemblyExceptionInfoPass(PassRegistry
&);
81 void initializeWebAssemblyCFGSortPass(PassRegistry
&);
82 void initializeWebAssemblyCFGStackifyPass(PassRegistry
&);
83 void initializeWebAssemblyExplicitLocalsPass(PassRegistry
&);
84 void initializeWebAssemblyLowerBrUnlessPass(PassRegistry
&);
85 void initializeWebAssemblyRegNumberingPass(PassRegistry
&);
86 void initializeWebAssemblyDebugFixupPass(PassRegistry
&);
87 void initializeWebAssemblyPeepholePass(PassRegistry
&);
88 void initializeWebAssemblyMCLowerPrePassPass(PassRegistry
&);
89 void initializeWebAssemblyLowerRefTypesIntPtrConvPass(PassRegistry
&);
91 namespace WebAssembly
{
93 // Followed by a local index (ULEB).
95 // Followed by an absolute global index (ULEB). DEPRECATED.
97 // Followed by the index from the bottom of the Wasm stack.
99 // Followed by a compilation unit relative global index (uint32_t)
100 // that will have an associated relocation.
102 // Like TI_LOCAL, but indicates an indirect value (e.g. byval arg
103 // passed by pointer).
106 } // end namespace WebAssembly
108 } // end namespace llvm