|
LLVM 24.0.0git
|
This file converts any remaining registers into WebAssembly locals. More...
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"#include "WebAssembly.h"#include "WebAssemblyDebugValueManager.h"#include "WebAssemblyMachineFunctionInfo.h"#include "WebAssemblySubtarget.h"#include "WebAssemblyUtilities.h"#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachinePassManager.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/Passes.h"#include "llvm/IR/Analysis.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "wasm-explicit-locals" |
Functions | |
| INITIALIZE_PASS (WebAssemblyExplicitLocalsLegacy, DEBUG_TYPE, "Convert registers to WebAssembly locals", false, false) FunctionPass *llvm | |
| static void | checkFrameBase (WebAssemblyFunctionInfo &MFI, unsigned Local, unsigned Reg) |
| static unsigned | getLocalId (DenseMap< unsigned, unsigned > &Reg2Local, WebAssemblyFunctionInfo &MFI, unsigned &CurLocal, unsigned Reg) |
| Return a local id number for the given register, assigning it a new one if it doesn't yet have one. | |
| static unsigned | getDropOpcode (const TargetRegisterClass *RC) |
| Get the appropriate drop opcode for the given register class. | |
| static unsigned | getLocalGetOpcode (const TargetRegisterClass *RC) |
| Get the appropriate local.get opcode for the given register class. | |
| static unsigned | getLocalSetOpcode (const TargetRegisterClass *RC) |
| Get the appropriate local.set opcode for the given register class. | |
| static unsigned | getLocalTeeOpcode (const TargetRegisterClass *RC) |
| Get the appropriate local.tee opcode for the given register class. | |
| static MVT | typeForRegClass (const TargetRegisterClass *RC) |
| Get the type associated with the given register class. | |
| static MachineInstr * | findStartOfTree (MachineOperand &MO, MachineRegisterInfo &MRI, const WebAssemblyFunctionInfo &MFI) |
| Given a MachineOperand of a stackified vreg, return the instruction at the start of the expression tree. | |
| static void | removeFakeUses (MachineFunction &MF) |
| static bool | explicitLocals (MachineFunction &MF) |
This file converts any remaining registers into WebAssembly locals.
After register stackification and register coloring, convert non-stackified registers into locals, inserting explicit local.get and local.set instructions.
Definition in file WebAssemblyExplicitLocals.cpp.
| #define DEBUG_TYPE "wasm-explicit-locals" |
Definition at line 35 of file WebAssemblyExplicitLocals.cpp.
|
static |
Definition at line 64 of file WebAssemblyExplicitLocals.cpp.
References llvm::dbgs(), llvm::WebAssemblyFunctionInfo::getFrameBaseVreg(), llvm::WebAssemblyFunctionInfo::isFrameBaseVirtual(), LLVM_DEBUG, Local, Reg, Register, and llvm::WebAssemblyFunctionInfo::setFrameBaseLocal().
Referenced by explicitLocals(), and getLocalId().
|
static |
Definition at line 233 of file WebAssemblyExplicitLocals.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::MachineFunction::begin(), llvm::BuildMI(), Changed, checkFrameBase(), llvm::WebAssemblyFunctionInfo::clearFrameBaseVreg(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::dbgs(), E(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), findStartOfTree(), llvm::MachineInstr::getDebugLoc(), getDropOpcode(), llvm::WebAssemblyFunctionInfo::getFrameBaseVreg(), llvm::MachineFunction::getFunction(), llvm::getImm(), llvm::MachineFunction::getInfo(), getLocalGetOpcode(), getLocalId(), llvm::WebAssemblyFunctionInfo::getLocals(), getLocalSetOpcode(), getLocalTeeOpcode(), llvm::MachineFunction::getName(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::WebAssemblyFunctionInfo::getParams(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::Function::getSubprogram(), llvm::MachineFunction::getSubtarget(), I, llvm::Register::index2VirtReg(), llvm::WebAssembly::isArgument(), llvm::WebAssembly::isCopy(), llvm::WebAssemblyFunctionInfo::isFrameBaseVirtual(), llvm::WebAssembly::isTee(), llvm::WebAssemblyFunctionInfo::isVRegStackified(), LLVM_DEBUG, Local, llvm::make_early_inc_range(), MBB, MI, Opc, Reg, removeFakeUses(), llvm::MachineRegisterInfo::replaceRegWith(), llvm::WebAssemblyDebugValueManager::replaceWithLocal(), llvm::reverse(), llvm::WebAssemblyFunctionInfo::setLocal(), llvm::WebAssemblyFunctionInfo::setNumLocals(), llvm::size(), llvm::WebAssemblyFunctionInfo::stackifyVReg(), TII, typeForRegClass(), llvm::WebAssemblyFunctionInfo::unstackifyVReg(), llvm::MachineRegisterInfo::use_empty(), and llvm::Register::virtRegIndex().
Referenced by llvm::WebAssemblyExplicitLocalsPass::run().
|
static |
Given a MachineOperand of a stackified vreg, return the instruction at the start of the expression tree.
Definition at line 196 of file WebAssemblyExplicitLocals.cpp.
References assert(), findStartOfTree(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getVRegDef(), llvm::WebAssemblyFunctionInfo::isVRegStackified(), and Reg.
Referenced by explicitLocals(), and findStartOfTree().
|
static |
Get the appropriate drop opcode for the given register class.
Definition at line 90 of file WebAssemblyExplicitLocals.cpp.
References llvm_unreachable.
Referenced by explicitLocals().
|
static |
Get the appropriate local.get opcode for the given register class.
Definition at line 111 of file WebAssemblyExplicitLocals.cpp.
References llvm_unreachable.
Referenced by explicitLocals().
|
static |
Return a local id number for the given register, assigning it a new one if it doesn't yet have one.
Definition at line 78 of file WebAssemblyExplicitLocals.cpp.
References checkFrameBase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), P, and Reg.
Referenced by explicitLocals().
|
static |
Get the appropriate local.set opcode for the given register class.
Definition at line 132 of file WebAssemblyExplicitLocals.cpp.
References llvm_unreachable.
Referenced by explicitLocals().
|
static |
Get the appropriate local.tee opcode for the given register class.
Definition at line 153 of file WebAssemblyExplicitLocals.cpp.
References llvm_unreachable.
Referenced by explicitLocals().
| INITIALIZE_PASS | ( | WebAssemblyExplicitLocalsLegacy | , |
| DEBUG_TYPE | , | ||
| "Convert registers to WebAssembly locals" | , | ||
| false | , | ||
| false | ) |
Definition at line 57 of file WebAssemblyExplicitLocals.cpp.
References llvm::createWebAssemblyExplicitLocalsLegacyPass(), and DEBUG_TYPE.
|
static |
Definition at line 223 of file WebAssemblyExplicitLocals.cpp.
References MBB, MI, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by explicitLocals().
|
static |
Get the type associated with the given register class.
Definition at line 174 of file WebAssemblyExplicitLocals.cpp.
References llvm_unreachable.
Referenced by explicitLocals().