LIR skeleton, renaming some types to prevent conflict.
This commit is contained in:
@@ -16,13 +16,13 @@ using namespace alloy::hir;
|
||||
|
||||
|
||||
ConstantPropagationPass::ConstantPropagationPass() :
|
||||
Pass() {
|
||||
CompilerPass() {
|
||||
}
|
||||
|
||||
ConstantPropagationPass::~ConstantPropagationPass() {
|
||||
}
|
||||
|
||||
int ConstantPropagationPass::Run(FunctionBuilder* builder) {
|
||||
int ConstantPropagationPass::Run(HIRBuilder* builder) {
|
||||
// Once ContextPromotion has run there will likely be a whole slew of
|
||||
// constants that can be pushed through the function.
|
||||
// Example:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef ALLOY_COMPILER_PASSES_CONSTANT_PROPAGATION_PASS_H_
|
||||
#define ALLOY_COMPILER_PASSES_CONSTANT_PROPAGATION_PASS_H_
|
||||
|
||||
#include <alloy/compiler/pass.h>
|
||||
#include <alloy/compiler/compiler_pass.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
@@ -18,12 +18,12 @@ namespace compiler {
|
||||
namespace passes {
|
||||
|
||||
|
||||
class ConstantPropagationPass : public Pass {
|
||||
class ConstantPropagationPass : public CompilerPass {
|
||||
public:
|
||||
ConstantPropagationPass();
|
||||
virtual ~ConstantPropagationPass();
|
||||
|
||||
virtual int Run(hir::FunctionBuilder* builder);
|
||||
virtual int Run(hir::HIRBuilder* builder);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ using namespace alloy::runtime;
|
||||
|
||||
ContextPromotionPass::ContextPromotionPass() :
|
||||
context_values_size_(0), context_values_(0),
|
||||
Pass() {
|
||||
CompilerPass() {
|
||||
}
|
||||
|
||||
ContextPromotionPass::~ContextPromotionPass() {
|
||||
@@ -32,7 +32,7 @@ ContextPromotionPass::~ContextPromotionPass() {
|
||||
}
|
||||
|
||||
int ContextPromotionPass::Initialize(Compiler* compiler) {
|
||||
if (Pass::Initialize(compiler)) {
|
||||
if (CompilerPass::Initialize(compiler)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ int ContextPromotionPass::Initialize(Compiler* compiler) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ContextPromotionPass::Run(FunctionBuilder* builder) {
|
||||
int ContextPromotionPass::Run(HIRBuilder* builder) {
|
||||
// Like mem2reg, but because context memory is unaliasable it's easier to
|
||||
// check and convert LoadContext/StoreContext into value operations.
|
||||
// Example of load->value promotion:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef ALLOY_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
#define ALLOY_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
|
||||
#include <alloy/compiler/pass.h>
|
||||
#include <alloy/compiler/compiler_pass.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
@@ -18,14 +18,14 @@ namespace compiler {
|
||||
namespace passes {
|
||||
|
||||
|
||||
class ContextPromotionPass : public Pass {
|
||||
class ContextPromotionPass : public CompilerPass {
|
||||
public:
|
||||
ContextPromotionPass();
|
||||
virtual ~ContextPromotionPass();
|
||||
|
||||
virtual int Initialize(Compiler* compiler);
|
||||
|
||||
virtual int Run(hir::FunctionBuilder* builder);
|
||||
virtual int Run(hir::HIRBuilder* builder);
|
||||
|
||||
private:
|
||||
void PromoteBlock(hir::Block* block);
|
||||
|
||||
@@ -16,13 +16,13 @@ using namespace alloy::hir;
|
||||
|
||||
|
||||
DeadCodeEliminationPass::DeadCodeEliminationPass() :
|
||||
Pass() {
|
||||
CompilerPass() {
|
||||
}
|
||||
|
||||
DeadCodeEliminationPass::~DeadCodeEliminationPass() {
|
||||
}
|
||||
|
||||
int DeadCodeEliminationPass::Run(FunctionBuilder* builder) {
|
||||
int DeadCodeEliminationPass::Run(HIRBuilder* builder) {
|
||||
// ContextPromotion/DSE will likely leave around a lot of dead statements.
|
||||
// Code generated for comparison/testing produces many unused statements and
|
||||
// with proper use analysis it should be possible to remove most of them:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef ALLOY_COMPILER_PASSES_DEAD_CODE_ELIMINATION_PASS_H_
|
||||
#define ALLOY_COMPILER_PASSES_DEAD_CODE_ELIMINATION_PASS_H_
|
||||
|
||||
#include <alloy/compiler/pass.h>
|
||||
#include <alloy/compiler/compiler_pass.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
@@ -18,12 +18,12 @@ namespace compiler {
|
||||
namespace passes {
|
||||
|
||||
|
||||
class DeadCodeEliminationPass : public Pass {
|
||||
class DeadCodeEliminationPass : public CompilerPass {
|
||||
public:
|
||||
DeadCodeEliminationPass();
|
||||
virtual ~DeadCodeEliminationPass();
|
||||
|
||||
virtual int Run(hir::FunctionBuilder* builder);
|
||||
virtual int Run(hir::HIRBuilder* builder);
|
||||
|
||||
private:
|
||||
void MakeNopRecursive(hir::Instr* i);
|
||||
|
||||
@@ -16,13 +16,13 @@ using namespace alloy::hir;
|
||||
|
||||
|
||||
SimplificationPass::SimplificationPass() :
|
||||
Pass() {
|
||||
CompilerPass() {
|
||||
}
|
||||
|
||||
SimplificationPass::~SimplificationPass() {
|
||||
}
|
||||
|
||||
int SimplificationPass::Run(FunctionBuilder* builder) {
|
||||
int SimplificationPass::Run(HIRBuilder* builder) {
|
||||
// Run over the instructions and rename assigned variables:
|
||||
// v1 = v0
|
||||
// v2 = v1
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef ALLOY_COMPILER_PASSES_SIMPLIFICATION_PASS_H_
|
||||
#define ALLOY_COMPILER_PASSES_SIMPLIFICATION_PASS_H_
|
||||
|
||||
#include <alloy/compiler/pass.h>
|
||||
#include <alloy/compiler/compiler_pass.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
@@ -18,12 +18,12 @@ namespace compiler {
|
||||
namespace passes {
|
||||
|
||||
|
||||
class SimplificationPass : public Pass {
|
||||
class SimplificationPass : public CompilerPass {
|
||||
public:
|
||||
SimplificationPass();
|
||||
virtual ~SimplificationPass();
|
||||
|
||||
virtual int Run(hir::FunctionBuilder* builder);
|
||||
virtual int Run(hir::HIRBuilder* builder);
|
||||
|
||||
private:
|
||||
hir::Value* CheckValue(hir::Value* value);
|
||||
|
||||
Reference in New Issue
Block a user