mirror of https://github.com/inolen/redream.git
new name for redundant load/store elimination pass
This commit is contained in:
parent
07a1156eb5
commit
01233f03e6
|
@ -133,8 +133,8 @@ set(DREAVM_SOURCES
|
|||
src/jit/frontend/sh4/sh4_instr.cc
|
||||
src/jit/ir/ir_builder.cc
|
||||
src/jit/ir/passes/constant_propagation_pass.cc
|
||||
src/jit/ir/passes/context_promotion_pass.cc
|
||||
src/jit/ir/passes/control_flow_analysis_pass.cc
|
||||
src/jit/ir/passes/load_store_elimination_pass.cc
|
||||
src/jit/ir/passes/pass_runner.cc
|
||||
src/jit/ir/passes/register_allocation_pass.cc
|
||||
src/jit/ir/passes/validate_pass.cc
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "core/core.h"
|
||||
#include "emu/profiler.h"
|
||||
#include "jit/ir/passes/context_promotion_pass.h"
|
||||
#include "jit/ir/passes/load_store_elimination_pass.h"
|
||||
|
||||
using namespace dreavm::jit::ir;
|
||||
using namespace dreavm::jit::ir::passes;
|
||||
|
||||
void ContextPromotionPass::Run(IRBuilder &builder) {
|
||||
PROFILER_RUNTIME("ContextPromotionPass::Run");
|
||||
void LoadStoreEliminationPass::Run(IRBuilder &builder) {
|
||||
PROFILER_RUNTIME("LoadStoreEliminationPass::Run");
|
||||
|
||||
Reset();
|
||||
|
||||
|
@ -15,9 +15,9 @@ void ContextPromotionPass::Run(IRBuilder &builder) {
|
|||
}
|
||||
}
|
||||
|
||||
void ContextPromotionPass::Reset() { ClearAvailable(); }
|
||||
void LoadStoreEliminationPass::Reset() { ClearAvailable(); }
|
||||
|
||||
void ContextPromotionPass::ProcessBlock(Block *block) {
|
||||
void LoadStoreEliminationPass::ProcessBlock(Block *block) {
|
||||
// eliminate redundant loads
|
||||
{
|
||||
auto it = block->instrs().begin();
|
||||
|
@ -83,16 +83,16 @@ void ContextPromotionPass::ProcessBlock(Block *block) {
|
|||
}
|
||||
}
|
||||
|
||||
void ContextPromotionPass::ClearAvailable() { available_marker_++; }
|
||||
void LoadStoreEliminationPass::ClearAvailable() { available_marker_++; }
|
||||
|
||||
void ContextPromotionPass::ReserveAvailable(int offset) {
|
||||
void LoadStoreEliminationPass::ReserveAvailable(int offset) {
|
||||
if (offset >= (int)available_.size()) {
|
||||
available_.resize(offset + 1);
|
||||
available_values_.resize(offset + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Value *ContextPromotionPass::GetAvailable(int offset) {
|
||||
Value *LoadStoreEliminationPass::GetAvailable(int offset) {
|
||||
ReserveAvailable(offset);
|
||||
|
||||
if (available_[offset] < available_marker_) {
|
||||
|
@ -102,7 +102,7 @@ Value *ContextPromotionPass::GetAvailable(int offset) {
|
|||
return available_values_[offset];
|
||||
}
|
||||
|
||||
void ContextPromotionPass::SetAvailable(int offset, Value *v) {
|
||||
void LoadStoreEliminationPass::SetAvailable(int offset, Value *v) {
|
||||
ReserveAvailable(offset);
|
||||
|
||||
available_[offset] = available_marker_;
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef CONTEXT_PROMOTION_PASS_H
|
||||
#define CONTEXT_PROMOTION_PASS_H
|
||||
#ifndef LOAD_STORE_ELIMINATION_PASS_H
|
||||
#define LOAD_STORE_ELIMINATION_PASS_H
|
||||
|
||||
#include <vector>
|
||||
#include "jit/ir/passes/pass_runner.h"
|
||||
|
@ -9,7 +9,7 @@ namespace jit {
|
|||
namespace ir {
|
||||
namespace passes {
|
||||
|
||||
class ContextPromotionPass : public Pass {
|
||||
class LoadStoreEliminationPass : public Pass {
|
||||
public:
|
||||
void Run(IRBuilder &builder);
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include "jit/frontend/frontend.h"
|
||||
#include "jit/ir/ir_builder.h"
|
||||
#include "jit/ir/passes/constant_propagation_pass.h"
|
||||
#include "jit/ir/passes/context_promotion_pass.h"
|
||||
#include "jit/ir/passes/load_store_elimination_pass.h"
|
||||
#include "jit/ir/passes/control_flow_analysis_pass.h"
|
||||
#include "jit/ir/passes/register_allocation_pass.h"
|
||||
#include "jit/ir/passes/validate_pass.h"
|
||||
|
@ -34,7 +34,7 @@ Runtime::Runtime(Memory &memory, frontend::Frontend &frontend,
|
|||
|
||||
pass_runner_.AddPass(std::unique_ptr<Pass>(new ValidatePass()));
|
||||
pass_runner_.AddPass(std::unique_ptr<Pass>(new ControlFlowAnalysisPass()));
|
||||
pass_runner_.AddPass(std::unique_ptr<Pass>(new ContextPromotionPass()));
|
||||
pass_runner_.AddPass(std::unique_ptr<Pass>(new LoadStoreEliminationPass()));
|
||||
pass_runner_.AddPass(std::unique_ptr<Pass>(new ConstantPropagationPass()));
|
||||
pass_runner_.AddPass(
|
||||
std::unique_ptr<Pass>(new RegisterAllocationPass(backend_)));
|
||||
|
|
Loading…
Reference in New Issue