30 #define DEBUG_TYPE "wasm"
34 "enable-emscripten-cxx-exceptions",
35 cl::desc(
"WebAssembly Emscripten-style exception handling"),
40 "enable-emscripten-sjlj",
41 cl::desc(
"WebAssembly Emscripten-style setjmp/longjmp handling"),
73 TT.isArch64Bit() ?
"e-m:e-p:64:64-i64:64-n32:64-S128"
74 :
"e-m:e-p:32:32-i64:64-n32:64-S128",
105 auto &
I = SubtargetMap[CPU + FS];
111 I = llvm::make_unique<WebAssemblySubtarget>(
TargetTriple, CPU, FS, *
this);
124 return getTM<WebAssemblyTargetMachine>();
127 FunctionPass *createTargetRegisterAllocator(
bool)
override;
129 void addIRPasses()
override;
130 bool addInstSelector()
override;
131 void addPostRegAlloc()
override;
132 bool addGCPasses()
override {
return false; }
133 void addPreEmitPass()
override;
145 return new WebAssemblyPassConfig(
this, PM);
148 FunctionPass *WebAssemblyPassConfig::createTargetRegisterAllocator(
bool) {
157 void WebAssemblyPassConfig::addIRPasses() {
194 bool WebAssemblyPassConfig::addInstSelector() {
209 void WebAssemblyPassConfig::addPostRegAlloc() {
228 void WebAssemblyPassConfig::addPreEmitPass() {
FunctionPass * createWebAssemblyCallIndirectFixup()
ModulePass * createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
ModulePass * createWebAssemblyFixFunctionBitcasts()
static cl::opt< bool > EnableEmSjLj("enable-emscripten-sjlj", cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"), cl::init(false))
FunctionPass * createWebAssemblyArgumentMove()
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
char & FuncletLayoutID
This pass lays out funclets contiguously.
FunctionPass * createWebAssemblyRegNumbering()
Analysis pass providing the TargetTransformInfo.
FunctionPass * createWebAssemblyOptimizeLiveIntervals()
TargetIRAnalysis getTargetIRAnalysis() override
Get the TargetIRAnalysis for this target.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
virtual void addPreEmitPass()
This pass may be implemented by targets that want to run passes immediately before machine code is em...
This file declares the WebAssembly-specific subclass of TargetLoweringObjectFile. ...
FunctionPass * createLowerInvokePass()
FunctionPass * createAtomicExpandPass(const TargetMachine *TM)
No attributes have been set.
Target-Independent Code Generator Pass Configuration Options.
This file declares the WebAssembly-specific subclass of TargetMachine.
FunctionPass * createWebAssemblyPrepareForLiveIntervals()
FunctionPass * createUnreachableBlockEliminationPass()
createUnreachableBlockEliminationPass - The LLVM code generator does not work well with unreachable b...
initializer< Ty > init(const Ty &Val)
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique(Args &&...args)
Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object...
FunctionPass * createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a WebAssembly-specific DAG, ready for instruction scheduling...
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
This file provides WebAssembly-specific target descriptions.
FunctionPass * createWebAssemblySetP2AlignOperands()
virtual bool addInstSelector()
addInstSelector - This method should install an instruction selector pass, which converts from LLVM c...
FunctionPass * createWebAssemblyLowerBrUnless()
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
char & LiveDebugValuesID
LiveDebugValues pass.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
FunctionPass class - This class is used to implement most global optimizations.
void initializeWebAssemblyLowerEmscriptenEHSjLjPass(PassRegistry &)
char & MachineCopyPropagationID
MachineCopyPropagation - This pass performs copy propagation on machine instructions.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
static cl::opt< bool > EnableEmException("enable-emscripten-cxx-exceptions", cl::desc("WebAssembly Emscripten-style exception handling"), cl::init(false))
~WebAssemblyTargetMachine() override
Triple - Helper class for working with autoconf configuration names.
char & PostRASchedulerID
createPostRAScheduler - This pass performs post register allocation scheduling.
FunctionPass * createWebAssemblyStoreResults()
char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
FunctionPass * createWebAssemblyRegStackify()
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
FunctionPass * createWebAssemblyExplicitLocals()
WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
Create an WebAssembly architecture model.
FunctionPass * createWebAssemblyCFGStackify()
FunctionPass * createWebAssemblyFixIrreducibleControlFlow()
Pass * createLowerAtomicPass()
Target - Wrapper for Target specific information.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
FunctionPass * createWebAssemblyPeephole()
char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
FunctionPass * createWebAssemblyReplacePhysRegs()
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
void LLVMInitializeWebAssemblyTarget()
FunctionPass * createWebAssemblyRegColoring()
StringRef getValueAsString() const
Return the attribute's value as a string.
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
char & ShrinkWrapID
ShrinkWrap pass. Look for the best place to insert save and restore.
FunctionPass * createWebAssemblyOptimizeReturned()
StringRef - Represent a constant reference to a string, i.e.
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
Target & getTheWebAssemblyTarget32()
const WebAssemblySubtarget * getSubtargetImpl(const Function &F) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
Target & getTheWebAssemblyTarget64()