Initial Alloy implementation.

This is a regression in functionality and performance, but a much better
foundation for the future of the project (I think). It can run basic
apps under an SSA interpreter but doesn't support some of the features
required to do real 360 apps yet.
This commit is contained in:
Ben Vanik
2013-12-06 22:57:16 -08:00
parent 68b8737a58
commit fdb6a5cfa3
215 changed files with 20167 additions and 16704 deletions

View File

@@ -0,0 +1,53 @@
/**
******************************************************************************
* 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/compiler/compiler.h>
#include <alloy/compiler/pass.h>
#include <alloy/compiler/tracing.h>
using namespace alloy;
using namespace alloy::compiler;
using namespace alloy::hir;
Compiler::Compiler() {
alloy::tracing::WriteEvent(EventType::Init({
}));
}
Compiler::~Compiler() {
Reset();
for (PassList::iterator it = passes_.begin(); it != passes_.end(); ++it) {
Pass* pass = *it;
delete pass;
}
alloy::tracing::WriteEvent(EventType::Deinit({
}));
}
void Compiler::AddPass(Pass* pass) {
passes_.push_back(pass);
}
void Compiler::Reset() {
}
int Compiler::Compile(FunctionBuilder* builder) {
// TODO(benvanik): sophisticated stuff. Run passes in parallel, run until they
// stop changing things, etc.
for (PassList::iterator it = passes_.begin(); it != passes_.end(); ++it) {
Pass* pass = *it;
//
}
return 0;
}

View File

@@ -0,0 +1,44 @@
/**
******************************************************************************
* 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_COMPILER_COMPILER_H_
#define ALLOY_COMPILER_COMPILER_H_
#include <alloy/core.h>
#include <alloy/hir/function_builder.h>
namespace alloy {
namespace compiler {
class Pass;
class Compiler {
public:
Compiler();
~Compiler();
void AddPass(Pass* pass);
void Reset();
int Compile(hir::FunctionBuilder* builder);
private:
typedef std::vector<Pass*> PassList;
PassList passes_;
};
} // namespace compiler
} // namespace alloy
#endif // ALLOY_COMPILER_COMPILER_H_

View File

@@ -0,0 +1,20 @@
/**
******************************************************************************
* 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/compiler/pass.h>
using namespace alloy;
using namespace alloy::compiler;
Pass::Pass() {
}
Pass::~Pass() {
}

31
src/alloy/compiler/pass.h Normal file
View File

@@ -0,0 +1,31 @@
/**
******************************************************************************
* 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_COMPILER_PASS_H_
#define ALLOY_COMPILER_PASS_H_
#include <alloy/core.h>
namespace alloy {
namespace compiler {
class Pass {
public:
Pass();
virtual ~Pass();
};
} // namespace compiler
} // namespace alloy
#endif // ALLOY_COMPILER_PASS_H_

View File

@@ -0,0 +1,15 @@
/**
******************************************************************************
* 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_COMPILER_PASSES_H_
#define ALLOY_COMPILER_PASSES_H_
#include <alloy/compiler/passes/mem2reg_pass.h>
#endif // ALLOY_COMPILER_PASSES_H_

View File

@@ -0,0 +1,22 @@
/**
******************************************************************************
* 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/compiler/passes/mem2reg_pass.h>
using namespace alloy;
using namespace alloy::compiler;
using namespace alloy::compiler::passes;
Mem2RegPass::Mem2RegPass() :
Pass() {
}
Mem2RegPass::~Mem2RegPass() {
}

View File

@@ -0,0 +1,33 @@
/**
******************************************************************************
* 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_COMPILER_PASSES_MEM2REG_PASS_H_
#define ALLOY_COMPILER_PASSES_MEM2REG_PASS_H_
#include <alloy/compiler/pass.h>
namespace alloy {
namespace compiler {
namespace passes {
class Mem2RegPass : public Pass {
public:
Mem2RegPass();
virtual ~Mem2RegPass();
};
} // namespace passes
} // namespace compiler
} // namespace alloy
#endif // ALLOY_COMPILER_PASSES_MEM2REG_PASS_H_

View File

@@ -0,0 +1,7 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'mem2reg_pass.cc',
'mem2reg_pass.h',
],
}

View File

@@ -0,0 +1,15 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'compiler.cc',
'compiler.h',
'pass.cc',
'pass.h',
'passes.h',
'tracing.h',
],
'includes': [
'passes/sources.gypi',
],
}

View File

@@ -0,0 +1,43 @@
/**
******************************************************************************
* 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_COMPILER_TRACING_H_
#define ALLOY_COMPILER_TRACING_H_
#include <alloy/tracing/tracing.h>
#include <alloy/tracing/event_type.h>
namespace alloy {
namespace compiler {
const uint32_t ALLOY_COMPILER = alloy::tracing::EventType::ALLOY_COMPILER;
class EventType {
public:
enum {
ALLOY_COMPILER_INIT = ALLOY_COMPILER | (1),
ALLOY_COMPILER_DEINIT = ALLOY_COMPILER | (2),
};
typedef struct {
static const uint32_t event_type = ALLOY_COMPILER_INIT;
} Init;
typedef struct {
static const uint32_t event_type = ALLOY_COMPILER_DEINIT;
} Deinit;
};
} // namespace compiler
} // namespace alloy
#endif // ALLOY_COMPILER_TRACING_H_