blob: f36ca7d6e227980c64c187603f491b9d2ff938ab [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//===-- WebAssembly.h - Top-level interface for WebAssembly ----*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Dan Gohman10e730a2015-06-29 23:51:55 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000010/// This file contains the entry points for global functions defined in
Dan Gohman10e730a2015-06-29 23:51:55 +000011/// 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
Derek Schufff41f67d2016-08-01 21:34:04 +000018#include "llvm/PassRegistry.h"
Dan Gohman10e730a2015-06-29 23:51:55 +000019#include "llvm/Support/CodeGen.h"
20
21namespace llvm {
22
23class WebAssemblyTargetMachine;
Derek Schufff41f67d2016-08-01 21:34:04 +000024class ModulePass;
Dan Gohman10e730a2015-06-29 23:51:55 +000025class FunctionPass;
26
Dan Gohman0cfb5f82016-05-10 04:24:02 +000027// LLVM IR passes.
Derek Schuffccdceda2016-08-18 15:27:25 +000028ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj);
Sam Cleggbafe6902017-12-15 00:17:10 +000029ModulePass *createWebAssemblyLowerGlobalDtors();
Sam Clegg92617552018-07-11 04:29:36 +000030ModulePass *createWebAssemblyAddMissingPrototypes();
Dan Gohman1b637452017-01-07 00:34:54 +000031ModulePass *createWebAssemblyFixFunctionBitcasts();
Dan Gohman81719f82015-11-25 16:55:01 +000032FunctionPass *createWebAssemblyOptimizeReturned();
33
Dan Gohman0cfb5f82016-05-10 04:24:02 +000034// ISel and immediate followup passes.
Dan Gohman10e730a2015-06-29 23:51:55 +000035FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM,
36 CodeGenOpt::Level OptLevel);
Dan Gohman1cf96c02015-12-09 16:23:59 +000037FunctionPass *createWebAssemblyArgumentMove();
Dan Gohmanbb372242016-01-26 03:39:31 +000038FunctionPass *createWebAssemblySetP2AlignOperands();
Dan Gohman10e730a2015-06-29 23:51:55 +000039
Dan Gohman0cfb5f82016-05-10 04:24:02 +000040// Late passes.
41FunctionPass *createWebAssemblyReplacePhysRegs();
42FunctionPass *createWebAssemblyPrepareForLiveIntervals();
43FunctionPass *createWebAssemblyOptimizeLiveIntervals();
Heejin Ahn321d5222019-01-08 22:35:18 +000044FunctionPass *createWebAssemblyMemIntrinsicResults();
Dan Gohman1462faa2015-11-16 16:18:28 +000045FunctionPass *createWebAssemblyRegStackify();
46FunctionPass *createWebAssemblyRegColoring();
Dan Gohmand7a2eea2016-03-09 02:01:14 +000047FunctionPass *createWebAssemblyFixIrreducibleControlFlow();
Heejin Ahn4934f762018-06-25 01:07:11 +000048FunctionPass *createWebAssemblyLateEHPrepare();
Dan Gohmanf52ee172017-02-27 22:38:58 +000049FunctionPass *createWebAssemblyCFGSort();
Dan Gohman950a13c2015-09-16 16:51:30 +000050FunctionPass *createWebAssemblyCFGStackify();
Heejin Ahne9fd9072019-03-30 09:29:57 +000051FunctionPass *createWebAssemblyExplicitLocals();
Dan Gohmanf0b165a2015-12-05 03:03:35 +000052FunctionPass *createWebAssemblyLowerBrUnless();
Dan Gohmancf4748f2015-11-12 17:04:33 +000053FunctionPass *createWebAssemblyRegNumbering();
Wouter van Oortmerssen2b7fe082020-04-30 11:41:39 -070054FunctionPass *createWebAssemblyDebugFixup();
Dan Gohman81719f82015-11-25 16:55:01 +000055FunctionPass *createWebAssemblyPeephole();
Dan Gohman950a13c2015-09-16 16:51:30 +000056
Jacob Gravelle40926452018-03-30 20:36:58 +000057// PassRegistry initialization declarations.
Sam Clegg92617552018-07-11 04:29:36 +000058void initializeWebAssemblyAddMissingPrototypesPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000059void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &);
60void initializeLowerGlobalDtorsPass(PassRegistry &);
61void initializeFixFunctionBitcastsPass(PassRegistry &);
62void initializeOptimizeReturnedPass(PassRegistry &);
63void initializeWebAssemblyArgumentMovePass(PassRegistry &);
64void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &);
65void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &);
66void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &);
67void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &);
Heejin Ahn321d5222019-01-08 22:35:18 +000068void initializeWebAssemblyMemIntrinsicResultsPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000069void initializeWebAssemblyRegStackifyPass(PassRegistry &);
70void initializeWebAssemblyRegColoringPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000071void initializeWebAssemblyFixIrreducibleControlFlowPass(PassRegistry &);
Heejin Ahn4934f762018-06-25 01:07:11 +000072void initializeWebAssemblyLateEHPreparePass(PassRegistry &);
Heejin Ahn04c48942018-06-25 01:20:21 +000073void initializeWebAssemblyExceptionInfoPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000074void initializeWebAssemblyCFGSortPass(PassRegistry &);
75void initializeWebAssemblyCFGStackifyPass(PassRegistry &);
Heejin Ahne9fd9072019-03-30 09:29:57 +000076void initializeWebAssemblyExplicitLocalsPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000077void initializeWebAssemblyLowerBrUnlessPass(PassRegistry &);
78void initializeWebAssemblyRegNumberingPass(PassRegistry &);
Wouter van Oortmerssen2b7fe082020-04-30 11:41:39 -070079void initializeWebAssemblyDebugFixupPass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000080void initializeWebAssemblyPeepholePass(PassRegistry &);
Jacob Gravelle40926452018-03-30 20:36:58 +000081
Yury Delendikadf7a0a2019-12-20 14:31:56 -080082namespace WebAssembly {
Wouter van Oortmerssen48139eb2020-03-19 19:53:51 -070083enum TargetIndex {
84 // Followed by a local index (ULEB).
85 TI_LOCAL,
86 // Followed by an absolute global index (ULEB). DEPRECATED.
87 TI_GLOBAL_FIXED,
88 TI_OPERAND_STACK,
89 // Followed by a compilation unit relative global index (uint32_t)
90 // that will have an associated relocation.
91 TI_GLOBAL_RELOC
92};
Yury Delendikadf7a0a2019-12-20 14:31:56 -080093} // end namespace WebAssembly
94
Dan Gohman10e730a2015-06-29 23:51:55 +000095} // end namespace llvm
96
97#endif