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

source code of llvm/lib/Target/WebAssembly/WebAssembly.h