|
LLVM
4.0.0
|
This file implements an optimization pass using store result values. More...
#include "WebAssembly.h"#include "MCTargetDesc/WebAssemblyMCTargetDesc.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"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) |
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.
| #define DEBUG_TYPE "wasm-store-results" |
Definition at line 41 of file WebAssemblyStoreResults.cpp.
|
static |
Definition at line 140 of file WebAssemblyStoreResults.cpp.
References llvm::TargetLoweringBase::getLibcallName(), llvm::TargetLibraryInfo::getLibFunc(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineOperand::getSymbolName(), llvm::MachineOperand::isSymbol(), llvm::RTLIB::MEMCPY, llvm::RTLIB::MEMMOVE, llvm::RTLIB::MEMSET, ReplaceDominatedUses(), and llvm::report_fatal_error().
|
static |
Definition at line 76 of file WebAssemblyStoreResults.cpp.
References llvm::MachineInstr::addRegisterKilled(), llvm::dbgs(), DEBUG, llvm::MachineDominatorTree::dominates(), E, llvm::LiveIntervals::extendToIndices(), llvm::SlotIndex::getDeadSlot(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getParent(), llvm::SlotIndex::getRegSlot(), llvm::MachineFunction::getSubtarget(), llvm::LiveRange::getVNInfoAt(), I, llvm::MachineOperand::isUndef(), llvm::LiveRange::liveAt(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::MachineOperand::setIsDead(), llvm::MachineOperand::setReg(), llvm::LiveIntervals::shrinkToUses(), llvm::MachineRegisterInfo::use_nodbg_begin(), and llvm::MachineRegisterInfo::use_nodbg_end().
Referenced by optimizeCall().
1.8.6