LLVM
8.0.1
|
This file implements an optimization pass using memory intrinsic results. More...
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "WebAssemblySubtarget.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/CodeGen/LiveIntervals.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-mem-intrinsic-results" |
Functions | |
INITIALIZE_PASS (WebAssemblyMemIntrinsicResults, DEBUG_TYPE, "Optimize memory intrinsic result values for WebAssembly", false, false) FunctionPass *llvm | |
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 memory intrinsic results.
Calls to memory intrinsics (memcpy, memmove, memset) return the destination address. They are in the form of dst_new = call dst, src, len where dst and dst_new registers contain the same value.
This is to enable an optimization wherein uses of the dst register used in the parameter can be replaced by uses of the dst_new register used in the result, making the dst register more likely to be single-use, thus more likely to be useful to register stackifying, and potentially also exposing the call instruction itself to register stackifying. These both can reduce local.get/local.set traffic.
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 WebAssemblyMemIntrinsicResults.cpp.
#define DEBUG_TYPE "wasm-mem-intrinsic-results" |
Definition at line 44 of file WebAssemblyMemIntrinsicResults.cpp.
INITIALIZE_PASS | ( | WebAssemblyMemIntrinsicResults | , |
DEBUG_TYPE | , | ||
"Optimize memory intrinsic result values for WebAssembly" | , | ||
false | , | ||
false | |||
) |
Definition at line 76 of file WebAssemblyMemIntrinsicResults.cpp.
|
static |
Definition at line 150 of file WebAssemblyMemIntrinsicResults.cpp.
References assert(), llvm::dbgs(), llvm::TargetLoweringBase::getLibcallName(), llvm::TargetLibraryInfo::getLibFunc(), llvm::MachineFunction::getName(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineOperand::getSymbolName(), llvm::MachineOperand::isSymbol(), LLVM_DEBUG, llvm::ARMISD::MEMCPY, MI, MRI, Name, ReplaceDominatedUses(), and llvm::report_fatal_error().
|
static |
Definition at line 85 of file WebAssemblyMemIntrinsicResults.cpp.
References llvm::MachineInstr::addRegisterKilled(), llvm::dbgs(), 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_DEBUG, llvm::RISCVFenceField::O, llvm::SmallVectorTemplateBase< T >::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().