Adding skeleton for reg allocator.

This commit is contained in:
Ben Vanik 2014-01-04 02:57:53 -08:00
parent 93ea56179a
commit a8eff63dbc
6 changed files with 71 additions and 0 deletions

View File

@ -12,5 +12,6 @@
#include <alloy/backend/x64/optimizer/passes/reachability_pass.h> #include <alloy/backend/x64/optimizer/passes/reachability_pass.h>
#include <alloy/backend/x64/optimizer/passes/redundant_mov_pass.h> #include <alloy/backend/x64/optimizer/passes/redundant_mov_pass.h>
#include <alloy/backend/x64/optimizer/passes/register_allocation_pass.h>
#endif // ALLOY_BACKEND_X64_OPTIMIZER_PASSES_H_ #endif // ALLOY_BACKEND_X64_OPTIMIZER_PASSES_H_

View File

@ -28,6 +28,7 @@ int ReachabilityPass::Run(LIRBuilder* builder) {
// TODO(benvanik): dead block removal. // TODO(benvanik): dead block removal.
// Remove unneeded jumps.
auto block = builder->first_block(); auto block = builder->first_block();
while (block) { while (block) {
auto tail = block->instr_tail; auto tail = block->instr_tail;

View File

@ -0,0 +1,27 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <alloy/backend/x64/optimizer/passes/register_allocation_pass.h>
using namespace alloy;
using namespace alloy::backend::x64::lir;
using namespace alloy::backend::x64::optimizer;
using namespace alloy::backend::x64::optimizer::passes;
RegisterAllocationPass::RegisterAllocationPass() :
OptimizerPass() {
}
RegisterAllocationPass::~RegisterAllocationPass() {
}
int RegisterAllocationPass::Run(LIRBuilder* builder) {
return 0;
}

View File

@ -0,0 +1,39 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef ALLOY_BACKEND_X64_OPTIMIZER_PASSES_REGISTER_ALLOCATION_PASS_H_
#define ALLOY_BACKEND_X64_OPTIMIZER_PASSES_REGISTER_ALLOCATION_PASS_H_
#include <alloy/backend/x64/optimizer/optimizer_pass.h>
namespace alloy {
namespace backend {
namespace x64 {
namespace optimizer {
namespace passes {
class RegisterAllocationPass : public OptimizerPass {
public:
RegisterAllocationPass();
virtual ~RegisterAllocationPass();
virtual int Run(lir::LIRBuilder* builder);
};
} // namespace passes
} // namespace optimizer
} // namespace x64
} // namespace backend
} // namespace alloy
#endif // ALLOY_BACKEND_X64_OPTIMIZER_PASSES_REGISTER_ALLOCATION_PASS_H_

View File

@ -5,5 +5,7 @@
'reachability_pass.h', 'reachability_pass.h',
'redundant_mov_pass.cc', 'redundant_mov_pass.cc',
'redundant_mov_pass.h', 'redundant_mov_pass.h',
'register_allocation_pass.cc',
'register_allocation_pass.h',
], ],
} }

View File

@ -60,6 +60,7 @@ int X64Assembler::Initialize() {
builder_ = new LIRBuilder(x64_backend_); builder_ = new LIRBuilder(x64_backend_);
optimizer_ = new Optimizer(backend_->runtime()); optimizer_ = new Optimizer(backend_->runtime());
optimizer_->AddPass(new passes::RegisterAllocationPass());
optimizer_->AddPass(new passes::RedundantMovPass()); optimizer_->AddPass(new passes::RedundantMovPass());
optimizer_->AddPass(new passes::ReachabilityPass()); optimizer_->AddPass(new passes::ReachabilityPass());