LLVM  6.0.0svn
Macros | Functions
WebAssemblyStoreResults.cpp File Reference

This file implements an optimization pass using store result values. More...

#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "WebAssemblySubtarget.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineDominators.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 WebAssemblyStoreResults.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "wasm-store-results"
 

Functions

static bool ReplaceDominatedUses (MachineBasicBlock &MBB, MachineInstr &MI, unsigned FromReg, unsigned ToReg, const MachineRegisterInfo &MRI, MachineDominatorTree &MDT, LiveIntervals &LIS)
 
static bool optimizeCall (MachineBasicBlock &MBB, MachineInstr &MI, const MachineRegisterInfo &MRI, MachineDominatorTree &MDT, LiveIntervals &LIS, const WebAssemblyTargetLowering &TLI, const TargetLibraryInfo &LibInfo)
 

Detailed Description

This file implements an optimization pass using store result values.

WebAssembly's store instructions return the stored value. This is to enable an optimization wherein uses of the stored value can be replaced by uses of the store's result value, making the stored value register more likely to be single-use, thus more likely to be useful to register stackifying, and potentially also exposing the store to register stackifying. These both can reduce get_local/set_local traffic.

This pass also performs this optimization for memcpy, memmove, and memset calls, since the LLVM intrinsics for these return void so they can't use the returned attribute and consequently aren't handled by the OptimizeReturned pass.

Definition in file WebAssemblyStoreResults.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "wasm-store-results"

Definition at line 41 of file WebAssemblyStoreResults.cpp.

Function Documentation

◆ optimizeCall()

static bool optimizeCall ( MachineBasicBlock MBB,
MachineInstr MI,
const MachineRegisterInfo MRI,
MachineDominatorTree MDT,
LiveIntervals LIS,
const WebAssemblyTargetLowering TLI,
const TargetLibraryInfo LibInfo 
)
static

◆ ReplaceDominatedUses()

static bool ReplaceDominatedUses ( MachineBasicBlock MBB,
MachineInstr MI,
unsigned  FromReg,
unsigned  ToReg,
const MachineRegisterInfo MRI,
MachineDominatorTree MDT,
LiveIntervals LIS 
)
static