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