LLVM 24.0.0git
WebAssemblyTargetMachine.cpp
Go to the documentation of this file.
1//===- WebAssemblyTargetMachine.cpp - Define TargetMachine for WebAssembly -==//
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 defines the WebAssembly-specific subclass of TargetMachine.
11///
12//===----------------------------------------------------------------------===//
13
17#include "WebAssembly.h"
28#include "llvm/CodeGen/Passes.h"
31#include "llvm/IR/Function.h"
38#include <optional>
39using namespace llvm;
40
41#define DEBUG_TYPE "wasm"
42
43// A command-line option to keep implicit locals
44// for the purpose of testing with lit/llc ONLY.
45// This produces output which is not valid WebAssembly, and is not supported
46// by assemblers/disassemblers and other MC based tools.
48 "wasm-disable-explicit-locals", cl::Hidden,
49 cl::desc("WebAssembly: output implicit locals in"
50 " instruction output for test purposes only."),
51 cl::init(false));
52
53// Exception handling & setjmp-longjmp handling related options.
54
55// Emscripten's asm.js-style setjmp/longjmp handling
57 "enable-emscripten-sjlj",
58 cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"),
59 cl::init(false));
60// setjmp/longjmp handling using wasm EH instructions
62 "wasm-enable-sjlj", cl::desc("WebAssembly setjmp/longjmp handling"));
63// If true, use the legacy Wasm EH proposal:
64// https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/legacy/Exceptions.md
65// And if false, use the standardized Wasm EH proposal:
66// https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md
67// Currently set to true by default because not all major web browsers turn on
68// the new standard proposal by default, but will later change to false.
70 "wasm-use-legacy-eh", cl::desc("WebAssembly exception handling (legacy)"),
71 cl::init(true));
72
75 // Register the target.
80
81 // Register backend passes
114}
115
116//===----------------------------------------------------------------------===//
117// WebAssembly Lowering public interface.
118//===----------------------------------------------------------------------===//
119
120static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) {
121 // Default to static relocation model. This should always be more optimal
122 // than PIC since the static linker can determine all global addresses and
123 // assume direct function calls.
124 return RM.value_or(Reloc::Static);
125}
126
130
132
134
135 // You can't enable two modes of SjLj at the same time
136 if (WasmEnableEmSjLj && WasmEnableSjLj)
138 "-enable-emscripten-sjlj not allowed with -wasm-enable-sjlj");
139 // You can't mix Emscripten EH with Wasm SjLj.
140 if (EnableEmEH && WasmEnableSjLj)
142 "-exception-model=emscripten not allowed with -wasm-enable-sjlj");
143
145 // FIXME: This flag should be removed in favor of directly using the
146 // generically configured ExceptionsType.
149 }
150
151 // Basic Correctness checking related to -exception-model
157 "-exception-model should be either 'none', 'wasm', or 'emscripten'");
158 if (WasmEnableSjLj && TM->Options.ExceptionModel != ExceptionHandling::Wasm)
160 "-wasm-enable-sjlj only allowed with -exception-model=wasm");
161
162 // Currently it is allowed to mix Wasm EH with Emscripten SjLj as an interim
163 // measure, but some code will error out at compile time in this combination.
164 // See WebAssemblyLowerEmscriptenEHSjLj pass for details.
165}
166
167/// Create an WebAssembly architecture model.
168///
170 const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
171 const TargetOptions &Options, std::optional<Reloc::Model> RM,
172 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, bool JIT)
173 : CodeGenTargetMachineImpl(T, TT, CPU, FS, Options,
175 getEffectiveCodeModel(CM, CodeModel::Large), OL),
176 TLOF(new WebAssemblyTargetObjectFile()) {
177 // WebAssembly type-checks instructions, but a noreturn function with a return
178 // type that doesn't match the context will cause a check failure. So we lower
179 // LLVM 'unreachable' to ISD::TRAP and then lower that to WebAssembly's
180 // 'unreachable' instructions which is meant for that case. Formerly, we also
181 // needed to add checks to SP failure emission in the instruction selection
182 // backends, but this has since been tied to TrapUnreachable and is no longer
183 // necessary.
184 this->Options.TrapUnreachable = true;
185 this->Options.NoTrapAfterNoreturn = false;
186
187 // WebAssembly treats each function as an independent unit. Force
188 // -ffunction-sections, effectively, so that we can emit them independently.
189 this->Options.FunctionSections = true;
190 this->Options.DataSections = true;
191 this->Options.UniqueSectionNames = true;
192
194 initAsmInfo();
195
196 // WebAssembly does not run RegAllocFast; tied operands must be lowered by
197 // TwoAddressInstructionPass.
199
201
202 // Note that we don't use setRequiresStructuredCFG(true). It disables
203 // optimizations than we're ok with, and want, such as critical edge
204 // splitting and tail merging.
205}
206
208
211 StringRef ABIName) const {
212 auto &I = SubtargetMap[CPU.str() + FS.str() + ABIName.str()];
213 if (!I) {
214 I = std::make_unique<WebAssemblySubtarget>(TargetTriple, CPU, FS, *this,
215 ABIName);
216 }
217 return I.get();
218}
219
222 Attribute CPUAttr = F.getFnAttribute("target-cpu");
223 Attribute FSAttr = F.getFnAttribute("target-features");
224
225 StringRef CPU = CPUAttr.isValid() ? CPUAttr.getValueAsString() : TargetCPU;
226 StringRef FS = FSAttr.isValid() ? FSAttr.getValueAsString() : TargetFS;
227
228 return getSubtargetImpl(CPU, FS, getTargetABIName(*F.getParent()));
229}
230
231namespace {
232
233/// WebAssembly Code Generator Pass Configuration Options.
234class WebAssemblyPassConfig final : public TargetPassConfig {
235public:
236 WebAssemblyPassConfig(WebAssemblyTargetMachine &TM, PassManagerBase &PM)
237 : TargetPassConfig(TM, PM) {}
238
239 WebAssemblyTargetMachine &getWebAssemblyTargetMachine() const {
241 }
242
243 FunctionPass *createTargetRegisterAllocator(bool) override;
244
245 void addIRPasses() override;
246 void addPassesToHandleExceptions() override;
247 void addISelPrepare() override;
248 bool addInstSelector() override;
249 void addOptimizedRegAlloc() override;
250 void addPostRegAlloc() override;
251 bool addGCPasses() override { return false; }
252 void addPreEmitPass() override;
253 bool addPreISel() override;
254
255 // No reg alloc
256 bool addRegAssignAndRewriteFast() override { return false; }
257
258 // No reg alloc
259 bool addRegAssignAndRewriteOptimized() override { return false; }
260
261 bool addIRTranslator() override;
262 void addPreLegalizeMachineIR() override;
263 bool addLegalizeMachineIR() override;
264 void addPreRegBankSelect() override;
265 bool addRegBankSelect() override;
266 bool addGlobalInstructionSelect() override;
267};
268} // end anonymous namespace
269
276
279 return TargetTransformInfo(std::make_unique<WebAssemblyTTIImpl>(this, F));
280}
281
284 return new WebAssemblyPassConfig(*this, PM);
285}
286
287FunctionPass *WebAssemblyPassConfig::createTargetRegisterAllocator(bool) {
288 return nullptr; // No reg alloc
289}
290
291//===----------------------------------------------------------------------===//
292// The following functions are called from lib/CodeGen/Passes.cpp to modify
293// the CodeGen pass sequence.
294//===----------------------------------------------------------------------===//
295
296void WebAssemblyPassConfig::addIRPasses() {
297 // Add signatures to prototype-less function declarations
299
300 // Lower .llvm.global_dtors into .llvm.global_ctors with __cxa_atexit calls.
302
303 // Fix function bitcasts, as WebAssembly requires caller and callee signatures
304 // to match.
306
307 // Optimize "returned" function attributes.
308 if (getOptLevel() != CodeGenOptLevel::None)
310
311 // Wasm SjLj shares Emscripten SjLj's transformation, so it is handled here.
312 // Without Wasm or Emscripten EH, this also lowers invokes.
314
315 // Expand indirectbr instructions to switches.
316 addPass(createIndirectBrExpandPass(getOptLevel()));
317
318 // Try to expand `vecreduce_{and, or}` into `{any, all}_true`.
320 getWebAssemblyTargetMachine()));
321
323}
324
325void WebAssemblyPassConfig::addPassesToHandleExceptions() {
326 // Wasm EH needs WinEHPrepare to remove the catchswitch PHIs SelectionDAG
327 // cannot lower.
328 addPass(createWinEHPass());
329 addPass(createWasmEHPass());
330}
331
332void WebAssemblyPassConfig::addISelPrepare() {
333 // We need to move reference type allocas to WASM_ADDRESS_SPACE_VAR so that
334 // loads and stores are promoted to local.gets/local.sets.
336 // Lower atomics and TLS if necessary
338 getWebAssemblyTargetMachine()));
339
340 // This is a no-op if atomics are not used in the module
342
344}
345
346bool WebAssemblyPassConfig::addInstSelector() {
348 addPass(createWebAssemblyISelDagLegacyPass(getWebAssemblyTargetMachine(),
349 getOptLevel()));
350 // Run the argument-move pass immediately after the ScheduleDAG scheduler
351 // so that we can fix up the ARGUMENT instructions before anything else
352 // sees them in the wrong place.
354 // Set the p2align operands. This information is present during ISel, however
355 // it's inconvenient to collect. Collect it now, and update the immediate
356 // operands.
358
359 // Eliminate range checks and add default targets to br_table instructions.
361
362 // unreachable is terminator, non-terminator instruction after it is not
363 // allowed.
365
366 return false;
367}
368
369void WebAssemblyPassConfig::addOptimizedRegAlloc() {
370 // Currently RegisterCoalesce degrades wasm debug info quality by a
371 // significant margin. As a quick fix, disable this for -O1, which is often
372 // used for debugging large applications. Disabling this increases code size
373 // of Emscripten core benchmarks by ~5%, which is acceptable for -O1, which is
374 // usually not used for production builds.
375 // TODO Investigate why RegisterCoalesce degrades debug info quality and fix
376 // it properly
377 if (getOptLevel() == CodeGenOptLevel::Less)
378 disablePass(&RegisterCoalescerID);
380}
381
382void WebAssemblyPassConfig::addPostRegAlloc() {
383 // TODO: The following CodeGen passes don't currently support code containing
384 // virtual registers. Consider removing their restrictions and re-enabling
385 // them.
386
387 // These functions all require the NoVRegs property.
388 disablePass(&MachineLateInstrsCleanupID);
389 disablePass(&MachineCopyPropagationID);
390 disablePass(&PostRAMachineSinkingID);
391 disablePass(&PostRASchedulerID);
392 disablePass(&FuncletLayoutID);
393 disablePass(&StackMapLivenessID);
394 disablePass(&PatchableFunctionID);
395 disablePass(&ShrinkWrapID);
396 disablePass(&RemoveLoadsIntoFakeUsesID);
397
398 // This pass hurts code size for wasm because it can generate irreducible
399 // control flow.
400 disablePass(&MachineBlockPlacementID);
401
403}
404
405void WebAssemblyPassConfig::addPreEmitPass() {
407
408 // Nullify DBG_VALUE_LISTs that we cannot handle.
410
411 // Remove any unreachable blocks that may be left floating around.
412 // Rare, but possible. Needed for WebAssemblyFixIrreducibleControlFlow.
414
415 // Eliminate multiple-entry loops.
417
418 // Do various transformations for exception handling.
419 // Every CFG-changing optimizations should come before this.
421
422 // Now that we have a prologue and epilogue and all frame indices are
423 // rewritten, eliminate SP and FP. This allows them to be stackified,
424 // colored, and numbered with the rest of the registers.
426
427 // Preparations and optimizations related to register stackification.
428 if (getOptLevel() != CodeGenOptLevel::None) {
429 // Depend on LiveIntervals and perform some optimizations on it.
431
432 // Prepare memory intrinsic calls for register stackifying.
434 }
435
436 // Mark registers as representing wasm's value stack. This is a key
437 // code-compression technique in WebAssembly. We run this pass (and
438 // MemIntrinsicResults above) very late, so that it sees as much code as
439 // possible, including code emitted by PEI and expanded by late tail
440 // duplication.
441 addPass(createWebAssemblyRegStackifyLegacyPass(getOptLevel()));
442
443 if (getOptLevel() != CodeGenOptLevel::None) {
444 // Run the register coloring pass to reduce the total number of registers.
445 // This runs after stackification so that it doesn't consider registers
446 // that become stackified.
448 }
449
450 // Sort the blocks of the CFG into topological order, a prerequisite for
451 // BLOCK and LOOP markers.
453
454 // Insert BLOCK and LOOP markers.
456
457 // Insert explicit local.get and local.set operators.
460
461 // Lower br_unless into br_if.
463
464 // Perform the very last peephole optimizations on the code.
465 if (getOptLevel() != CodeGenOptLevel::None)
467
468 // Create a mapping from LLVM CodeGen virtual registers to wasm registers.
470
471 // Fix debug_values whose defs have been stackified.
474
475 // Collect information to prepare for MC lowering / asm printing.
477}
478
479bool WebAssemblyPassConfig::addPreISel() {
481 return false;
482}
483
484bool WebAssemblyPassConfig::addIRTranslator() {
485 addPass(new IRTranslatorLegacy());
486 return false;
487}
488
489void WebAssemblyPassConfig::addPreLegalizeMachineIR() {
490 if (getOptLevel() != CodeGenOptLevel::None) {
492 }
493}
494bool WebAssemblyPassConfig::addLegalizeMachineIR() {
495 addPass(new LegalizerLegacy());
496 return false;
497}
498
499void WebAssemblyPassConfig::addPreRegBankSelect() {
500 if (getOptLevel() != CodeGenOptLevel::None) {
502 }
503}
504
505bool WebAssemblyPassConfig::addRegBankSelect() {
506 addPass(new RegBankSelectLegacy());
507 return false;
508}
509
510bool WebAssemblyPassConfig::addGlobalInstructionSelect() {
511 addPass(new InstructionSelectLegacy(getOptLevel()));
512
513 // We insert only if ISelDAG won't insert these at a later point.
514 if (isGlobalISelAbortEnabled()) {
519 }
520
521 return false;
522}
523
528
534
537 SMDiagnostic &Error, SMRange &SourceRange) const {
538 const auto &YamlMFI = static_cast<const yaml::WebAssemblyFunctionInfo &>(MFI);
539 MachineFunction &MF = PFS.MF;
540 MF.getInfo<WebAssemblyFunctionInfo>()->initializeBaseYamlFields(MF, YamlMFI);
541 return false;
542}
static Reloc::Model getEffectiveRelocModel()
#define X(NUM, ENUM, NAME)
Definition ELF.h:857
#define LLVM_ABI
Definition Compiler.h:215
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
This file declares the IRTranslator pass.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define T
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
Target-Independent Code Generator Pass Configuration Options pass.
cl::opt< bool > WasmDisableExplicitLocals
This file defines the interfaces that WebAssembly uses to lower LLVM code into a selection DAG.
This file provides WebAssembly-specific target descriptions.
This file declares WebAssembly-specific per-machine-function information.
This file registers the WebAssembly target.
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTarget()
static void basicCheckForEHAndSjLj(TargetMachine *TM)
This file declares the WebAssembly-specific subclass of TargetMachine.
This file declares the WebAssembly-specific subclass of TargetLoweringObjectFile.
This file a TargetTransformInfoImplBase conforming object specific to the WebAssembly target machine.
This file contains the declaration of the WebAssembly-specific utility functions.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:106
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition Attributes.h:266
CodeGenTargetMachineImpl(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
This pass is responsible for selecting generic machine instructions to target-specific instructions.
static void setUseExtended(bool Enable)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition SourceMgr.h:305
Represents a range in source code.
Definition SMLoc.h:47
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::string str() const
Get the contents as an std::string.
Definition StringRef.h:222
Primary interface to the complete machine description for the target machine.
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
StringRef getTargetABIName(const Module &M) const
Returns the effective target ABI name: the "target-abi" module flag if present, otherwise the -target...
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
void setEnableTiedFastRegAlloc(bool Value)
unsigned FunctionSections
Emit functions into separate sections.
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for 'unreachable' IR instructions behind noreturn calls,...
unsigned DataSections
Emit data into separate sections.
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
ExceptionHandling ExceptionModel
What exception model to use.
Target-Independent Code Generator Pass Configuration Options.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
virtual bool addInstSelector()
addInstSelector - This method should install an instruction selector pass, which converts from LLVM c...
virtual bool addPreISel()
Methods with trivial inline returns are convenient points in the common codegen pass pipeline where t...
virtual void addOptimizedRegAlloc()
addOptimizedRegAlloc - Add passes related to register allocation.
virtual void addPreEmitPass()
This pass may be implemented by targets that want to run passes immediately before machine code is em...
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
virtual void addISelPrepare()
Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
TargetSubtargetInfo - Generic base class for all target subtargets.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const override
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
const WebAssemblySubtarget * getSubtargetImpl(StringRef CPU, StringRef FS, StringRef ABIName) const
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const override
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
Create an WebAssembly architecture model.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const override
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
cl::opt< bool > WasmDisableExplicitLocals
cl::opt< bool > WasmUseLegacyEH
cl::opt< bool > WasmEnableSjLj
cl::opt< bool > WasmEnableEmSjLj
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI ModulePass * createLowerGlobalDtorsLegacyPass()
FunctionPass * createWebAssemblyExplicitLocalsLegacyPass()
LLVM_ABI FunctionPass * createWinEHPass()
createWinEHPass - Prepares personality functions used by MSVC on Windows, in addition to the Itanium ...
FunctionPass * createWebAssemblyCleanCodeAfterTrapLegacyPass()
ModulePass * createWebAssemblyMCLowerPreLegacyPass()
void initializeWebAssemblySetP2AlignOperandsLegacyPass(PassRegistry &)
void initializeWebAssemblyRegStackifyLegacyPass(PassRegistry &)
LLVM_ABI char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
void initializeWebAssemblyPeepholeLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createWasmEHPass()
createWasmEHPass - This pass adapts exception handling code to use WebAssembly's exception handling s...
LLVM_ABI char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
LLVM_ABI char & RemoveLoadsIntoFakeUsesID
RemoveLoadsIntoFakeUses pass.
void initializeWebAssemblyExceptionInfoWrapperPassPass(PassRegistry &)
FunctionPass * createWebAssemblyPreLegalizerCombinerLegacyPass()
FunctionPass * createWebAssemblyRegNumberingLegacyPass()
void initializeWebAssemblyDAGToDAGISelLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblySetP2AlignOperandsLegacyPass()
void initializeWebAssemblyPreLegalizerCombinerLegacyPass(PassRegistry &)
void initializeWebAssemblyMemIntrinsicResultsLegacyPass(PassRegistry &)
void initializeWebAssemblyRegNumberingLegacyPass(PassRegistry &)
void initializeWebAssemblyLateEHPrepareLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createIndirectBrExpandPass(CodeGenOptLevel OptLevel)
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
void initializeWebAssemblyNullifyDebugValueListsLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblyArgumentMoveLegacyPass()
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
LLVM_ABI char & ShrinkWrapID
ShrinkWrap pass. Look for the best place to insert save and restore.
LLVM_ABI char & MachineLateInstrsCleanupID
MachineLateInstrsCleanup - This pass removes redundant identical instructions after register allocati...
void initializeWebAssemblyRefTypeMem2LocalLegacyPass(PassRegistry &)
LLVM_ABI char & UnreachableMachineBlockElimID
UnreachableMachineBlockElimination - This pass removes unreachable machine basic blocks.
void initializeWebAssemblyFixFunctionBitcastsLegacyPass(PassRegistry &)
void initializeWebAssemblyLowerBrUnlessLegacyPass(PassRegistry &)
Target & getTheWebAssemblyTarget32()
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
LLVM_ABI char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
LLVM_ABI void initializeLowerGlobalDtorsLegacyPassPass(PassRegistry &)
FunctionPass * createWebAssemblyReduceToAnyAllTrueLegacyPass(WebAssemblyTargetMachine &TM)
FunctionPass * createWebAssemblyRegColoringLegacyPass()
LLVM_ABI char & FuncletLayoutID
This pass lays out funclets contiguously.
FunctionPass * createWebAssemblyPostLegalizerCombinerLegacyPass()
FunctionPass * createWebAssemblyFixIrreducibleControlFlowLegacyPass()
LLVM_ABI char & PostRAMachineSinkingID
This pass perform post-ra machine sink for COPY instructions.
void initializeWebAssemblyPostLegalizerCombinerLegacyPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:227
ModulePass * createWebAssemblyCoalesceFeaturesAndStripAtomicsLegacyPass(WebAssemblyTargetMachine &TM)
FunctionPass * createWebAssemblyRefTypeMem2LocalLegacyPass()
void initializeWebAssemblyArgumentMoveLegacyPass(PassRegistry &)
void initializeWebAssemblyOptimizeReturnedLegacyPass(PassRegistry &)
void initializeWebAssemblyExplicitLocalsLegacyPass(PassRegistry &)
ModulePass * createWebAssemblyFixFunctionBitcastsLegacyPass()
FunctionPass * createWebAssemblyPeepholeLegacyPass()
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
FunctionPass * createWebAssemblyMemIntrinsicResultsLegacyPass()
void initializeWebAssemblyLowerEmscriptenEHSjLjLegacyPass(PassRegistry &)
Target & getTheWebAssemblyTarget64()
FunctionPass * createWebAssemblyOptimizeReturnedLegacyPass()
ModulePass * createWebAssemblyLowerEmscriptenEHSjLjLegacyPass()
void initializeWebAssemblyFixBrTableDefaultsLegacyPass(PassRegistry &)
void initializeWebAssemblyAddMissingPrototypesLegacyPass(PassRegistry &)
@ Emscripten
Emscripten JavaScript-based exception handling.
Definition CodeGen.h:62
@ None
No exception support.
Definition CodeGen.h:56
@ Default
Not specified; resolve to the target's default model.
Definition CodeGen.h:55
@ Wasm
WebAssembly Exception Handling.
Definition CodeGen.h:61
void initializeWebAssemblyCFGSortLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblyDebugFixupLegacyPass()
FunctionPass * createWebAssemblyFixBrTableDefaultsLegacyPass()
FunctionPass * createWebAssemblyISelDagLegacyPass(WebAssemblyTargetMachine &TM, CodeGenOptLevel OptLevel)
FunctionPass * createWebAssemblyNullifyDebugValueListsLegacyPass()
FunctionPass * createWebAssemblyCFGStackifyLegacyPass()
void initializeWebAssemblyRegColoringLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblyRegStackifyLegacyPass(CodeGenOptLevel OptLevel)
FunctionPass * createWebAssemblyOptimizeLiveIntervalsLegacyPass()
void initializeWebAssemblyFixIrreducibleControlFlowLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblyLowerBrUnlessLegacyPass()
LLVM_ABI char & MachineBlockPlacementID
MachineBlockPlacement - This pass places basic blocks based on branch probabilities.
ModulePass * createWebAssemblyAddMissingPrototypesLegacyPass()
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:391
FunctionPass * createWebAssemblyReplacePhysRegsLegacyPass()
void initializeWebAssemblyCFGStackifyLegacyPass(PassRegistry &)
void initializeWebAssemblyOptimizeLiveIntervalsLegacyPass(PassRegistry &)
FunctionPass * createWebAssemblyCFGSortLegacyPass()
void initializeWebAssemblyMCLowerPreLegacyPass(PassRegistry &)
void initializeWebAssemblyAsmPrinterPass(PassRegistry &)
void initializeWebAssemblyReplacePhysRegsLegacyPass(PassRegistry &)
LLVM_ABI char & MachineCopyPropagationID
MachineCopyPropagation - This pass performs copy propagation on machine instructions.
FunctionPass * createWebAssemblyLateEHPrepareLegacyPass()
void initializeWebAssemblyDebugFixupLegacyPass(PassRegistry &)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
RegisterTargetMachine - Helper template for registering a target machine implementation,...
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.