WebAssembly.h 4.4 KB

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