[WebAssembly] Add new target feature in support of 'extended-const' proposal
[llvm-project.git] / llvm / lib / Target / WebAssembly / WebAssembly.h
blob803786e0c9c25afca2d1a9240fa19b12c50bb95e
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 //===----------------------------------------------------------------------===//
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"
21 namespace llvm {
23 class WebAssemblyTargetMachine;
24 class ModulePass;
25 class FunctionPass;
27 // LLVM IR passes.
28 ModulePass *createWebAssemblyLowerEmscriptenEHSjLj();
29 ModulePass *createWebAssemblyLowerGlobalDtors();
30 ModulePass *createWebAssemblyAddMissingPrototypes();
31 ModulePass *createWebAssemblyFixFunctionBitcasts();
32 FunctionPass *createWebAssemblyOptimizeReturned();
33 FunctionPass *createWebAssemblyLowerRefTypesIntPtrConv();
35 // ISel and immediate followup passes.
36 FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM,
37 CodeGenOpt::Level OptLevel);
38 FunctionPass *createWebAssemblyArgumentMove();
39 FunctionPass *createWebAssemblySetP2AlignOperands();
41 // Late passes.
42 FunctionPass *createWebAssemblyReplacePhysRegs();
43 FunctionPass *createWebAssemblyNullifyDebugValueLists();
44 FunctionPass *createWebAssemblyPrepareForLiveIntervals();
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();
61 // PassRegistry initialization declarations.
62 void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &);
63 void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &);
64 void initializeLowerGlobalDtorsPass(PassRegistry &);
65 void initializeFixFunctionBitcastsPass(PassRegistry &);
66 void initializeOptimizeReturnedPass(PassRegistry &);
67 void initializeWebAssemblyArgumentMovePass(PassRegistry &);
68 void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &);
69 void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &);
70 void initializeWebAssemblyNullifyDebugValueListsPass(PassRegistry &);
71 void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &);
72 void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &);
73 void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &);
74 void initializeWebAssemblyRegStackifyPass(PassRegistry &);
75 void initializeWebAssemblyRegColoringPass(PassRegistry &);
76 void initializeWebAssemblyFixBrTableDefaultsPass(PassRegistry &);
77 void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &);
78 void initializeWebAssemblyLateEHPreparePass(PassRegistry &);
79 void initializeWebAssemblyExceptionInfoPass(PassRegistry &);
80 void initializeWebAssemblyCFGSortPass(PassRegistry &);
81 void initializeWebAssemblyCFGStackifyPass(PassRegistry &);
82 void initializeWebAssemblyExplicitLocalsPass(PassRegistry &);
83 void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &);
84 void initializeWebAssemblyRegNumberingPass(PassRegistry &);
85 void initializeWebAssemblyDebugFixupPass(PassRegistry &);
86 void initializeWebAssemblyPeepholePass(PassRegistry &);
87 void initializeWebAssemblyMCLowerPrePassPass(PassRegistry &);
88 void initializeWebAssemblyLowerRefTypesIntPtrConvPass(PassRegistry &);
90 namespace WebAssembly {
91 enum TargetIndex {
92 // Followed by a local index (ULEB).
93 TI_LOCAL,
94 // Followed by an absolute global index (ULEB). DEPRECATED.
95 TI_GLOBAL_FIXED,
96 // Followed by the index from the bottom of the Wasm stack.
97 TI_OPERAND_STACK,
98 // Followed by a compilation unit relative global index (uint32_t)
99 // that will have an associated relocation.
100 TI_GLOBAL_RELOC,
101 // Like TI_LOCAL, but indicates an indirect value (e.g. byval arg
102 // passed by pointer).
103 TI_LOCAL_INDIRECT
105 } // end namespace WebAssembly
107 } // end namespace llvm
109 #endif