Basic ContextPromotionPass and some opcode info rearranging.

This commit is contained in:
Ben Vanik
2013-12-07 04:39:48 -08:00
parent 51d0be0f0a
commit 329b554c7a
25 changed files with 907 additions and 617 deletions

View File

@@ -0,0 +1,21 @@
/**
******************************************************************************
* 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/frontend/context_info.h>
using namespace alloy;
using namespace alloy::frontend;
ContextInfo::ContextInfo(size_t size) :
size_(size) {
}
ContextInfo::~ContextInfo() {
}

View File

@@ -0,0 +1,36 @@
/**
******************************************************************************
* 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_FRONTEND_CONTEXT_INFO_H_
#define ALLOY_FRONTEND_CONTEXT_INFO_H_
#include <alloy/core.h>
namespace alloy {
namespace frontend {
class ContextInfo {
public:
ContextInfo(size_t size);
~ContextInfo();
size_t size() const { return size_; }
private:
size_t size_;
};
} // namespace frontend
} // namespace alloy
#endif // ALLOY_FRONTEND_CONTEXT_INFO_H_

View File

@@ -18,10 +18,11 @@ using namespace alloy::runtime;
Frontend::Frontend(Runtime* runtime) :
runtime_(runtime) {
runtime_(runtime), context_info_(0) {
}
Frontend::~Frontend() {
delete context_info_;
}
Memory* Frontend::memory() const {

View File

@@ -12,6 +12,7 @@
#include <alloy/core.h>
#include <alloy/memory.h>
#include <alloy/frontend/context_info.h>
#include <alloy/runtime/function.h>
#include <alloy/runtime/symbol_info.h>
@@ -31,6 +32,7 @@ public:
runtime::Runtime* runtime() const { return runtime_; }
Memory* memory() const;
ContextInfo* context_info() const { return context_info_; }
virtual int Initialize();
@@ -42,6 +44,7 @@ public:
protected:
runtime::Runtime* runtime_;
ContextInfo* context_info_;
};

View File

@@ -10,6 +10,7 @@
#include <alloy/frontend/ppc/ppc_frontend.h>
#include <alloy/frontend/tracing.h>
#include <alloy/frontend/ppc/ppc_context.h>
#include <alloy/frontend/ppc/ppc_disasm.h>
#include <alloy/frontend/ppc/ppc_emit.h>
#include <alloy/frontend/ppc/ppc_translator.h>
@@ -54,6 +55,10 @@ namespace {
PPCFrontend::PPCFrontend(Runtime* runtime) :
Frontend(runtime) {
InitializeIfNeeded();
ContextInfo* info = new ContextInfo(sizeof(PPCContext));
// Add fields/etc.
context_info_ = info;
}
PPCFrontend::~PPCFrontend() {

View File

@@ -30,9 +30,9 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) :
scanner_ = new PPCScanner(frontend);
builder_ = new PPCFunctionBuilder(frontend);
compiler_ = new Compiler();
compiler_ = new Compiler(frontend->runtime());
//compiler_->AddPass(new passes::ContextPromotionPass());
compiler_->AddPass(new passes::ContextPromotionPass());
//compiler_->AddPass(new passes::ConstantPropagationPass());
//compiler_->AddPass(new passes::TypePropagationPass());
//compiler_->AddPass(new passes::ByteSwapEliminationPass());

View File

@@ -1,6 +1,8 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'context_info.cc',
'context_info.h',
'frontend.cc',
'frontend.h',
'tracing.h',