LLVM  5.0.0
Macros | Functions | Variables
WebAssemblyExplicitLocals.cpp File Reference

This file converts any remaining registers into WebAssembly locals. More...

#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "WebAssemblySubtarget.h"
#include "WebAssemblyUtilities.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for WebAssemblyExplicitLocals.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "wasm-explicit-locals"
 

Functions

static unsigned getLocalId (DenseMap< unsigned, unsigned > &Reg2Local, 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. More...
 
static unsigned getDropOpcode (const TargetRegisterClass *RC)
 Get the appropriate drop opcode for the given register class. More...
 
static unsigned getGetLocalOpcode (const TargetRegisterClass *RC)
 Get the appropriate get_local opcode for the given register class. More...
 
static unsigned getSetLocalOpcode (const TargetRegisterClass *RC)
 Get the appropriate set_local opcode for the given register class. More...
 
static unsigned getTeeLocalOpcode (const TargetRegisterClass *RC)
 Get the appropriate tee_local opcode for the given register class. More...
 
static MVT typeForRegClass (const TargetRegisterClass *RC)
 Get the type associated with the given register class. More...
 
static MachineInstr * FindStartOfTree (MachineOperand &MO, MachineRegisterInfo &MRI, WebAssemblyFunctionInfo &MFI)
 Given a MachineOperand of a stackified vreg, return the instruction at the start of the expression tree. More...
 

Variables

static cl::opt< bool > DisableWebAssemblyExplicitLocals ("disable-wasm-explicit-locals", cl::ReallyHidden, cl::desc("WebAssembly: Disable emission of get_local/set_local."), cl::init(false))
 

Detailed Description

This file converts any remaining registers into WebAssembly locals.

After register stackification and register coloring, convert non-stackified registers into locals, inserting explicit get_local and set_local instructions.

Definition in file WebAssemblyExplicitLocals.cpp.

Macro Definition Documentation

#define DEBUG_TYPE   "wasm-explicit-locals"

Definition at line 32 of file WebAssemblyExplicitLocals.cpp.

Function Documentation

static MachineInstr* FindStartOfTree ( MachineOperand &  MO,
MachineRegisterInfo &  MRI,
WebAssemblyFunctionInfo &  MFI 
)
static

Given a MachineOperand of a stackified vreg, return the instruction at the start of the expression tree.

Definition at line 152 of file WebAssemblyExplicitLocals.cpp.

References assert(), llvm::tgtok::Def, llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getVRegDef(), and llvm::WebAssemblyFunctionInfo::isVRegStackified().

static unsigned getDropOpcode ( const TargetRegisterClass *  RC)
static

Get the appropriate drop opcode for the given register class.

Definition at line 78 of file WebAssemblyExplicitLocals.cpp.

References llvm_unreachable().

static unsigned getGetLocalOpcode ( const TargetRegisterClass *  RC)
static

Get the appropriate get_local opcode for the given register class.

Definition at line 93 of file WebAssemblyExplicitLocals.cpp.

References llvm_unreachable().

static unsigned getLocalId ( DenseMap< unsigned, unsigned > &  Reg2Local,
unsigned &  CurLocal,
unsigned  Reg 
)
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 69 of file WebAssemblyExplicitLocals.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), and P.

static unsigned getSetLocalOpcode ( const TargetRegisterClass *  RC)
static

Get the appropriate set_local opcode for the given register class.

Definition at line 108 of file WebAssemblyExplicitLocals.cpp.

References llvm_unreachable().

static unsigned getTeeLocalOpcode ( const TargetRegisterClass *  RC)
static

Get the appropriate tee_local opcode for the given register class.

Definition at line 123 of file WebAssemblyExplicitLocals.cpp.

References llvm_unreachable().

static MVT typeForRegClass ( const TargetRegisterClass *  RC)
static

Get the type associated with the given register class.

Definition at line 138 of file WebAssemblyExplicitLocals.cpp.

References llvm::MVT::f32, llvm::MVT::f64, llvm::MVT::i32, llvm::MVT::i64, and llvm_unreachable().

Variable Documentation

cl::opt<bool> DisableWebAssemblyExplicitLocals("disable-wasm-explicit-locals", cl::ReallyHidden, cl::desc("WebAssembly: Disable emission of get_local/set_local."), cl::init(false))
static