//===-- WebAssemblyMCLowerPrePass.cpp - Prepare for MC lower --------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// Some information in MC lowering / asm printing gets generated as /// instructions get emitted, but may be necessary at the start, such as for /// .globaltype declarations. This pass collects this information. /// //===----------------------------------------------------------------------===// #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" #include "WebAssembly.h" #include "WebAssemblyMachineFunctionInfo.h" #include "WebAssemblySubtarget.h" #include "WebAssemblyUtilities.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/IR/Module.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" usingnamespacellvm; #define DEBUG_TYPE … namespace { class WebAssemblyMCLowerPrePass final : public ModulePass { … }; } // end anonymous namespace char WebAssemblyMCLowerPrePass::ID = …; INITIALIZE_PASS(…) ModulePass *llvm::createWebAssemblyMCLowerPrePass() { … } // NOTE: this is a ModulePass since we need to enforce that this code has run // for all functions before AsmPrinter. If this way of doing things is ever // suboptimal, we could opt to make it a MachineFunctionPass and instead use // something like createBarrierNoopPass() to enforce ordering. // // The information stored here is essential for emitExternalDecls in the Wasm // AsmPrinter bool WebAssemblyMCLowerPrePass::runOnModule(Module &M) { … }