Moving some util types into poly.

This commit is contained in:
Ben Vanik
2015-03-22 22:12:37 -07:00
parent b392afbfae
commit 59395318f3
54 changed files with 280 additions and 242 deletions

View File

@@ -10,7 +10,7 @@
#ifndef ALLOY_HIR_BLOCK_H_
#define ALLOY_HIR_BLOCK_H_
#include "alloy/arena.h"
#include "poly/arena.h"
namespace llvm {
class BitVector;
@@ -45,7 +45,7 @@ class Edge {
class Block {
public:
Arena* arena;
poly::Arena* arena;
Block* next;
Block* prev;

View File

@@ -13,7 +13,6 @@
#include "alloy/hir/instr.h"
#include "alloy/hir/label.h"
#include "alloy/runtime/symbol_info.h"
#include "alloy/string_buffer.h"
#include "xenia/profiling.h"
namespace alloy {
@@ -30,7 +29,7 @@ using alloy::runtime::FunctionInfo;
assert_true((value1->type) == (value2->type))
HIRBuilder::HIRBuilder() {
arena_ = new Arena();
arena_ = new poly::Arena();
Reset();
}
@@ -90,7 +89,7 @@ int HIRBuilder::Finalize() {
return 0;
}
void HIRBuilder::DumpValue(StringBuffer* str, Value* value) {
void HIRBuilder::DumpValue(poly::StringBuffer* str, Value* value) {
if (value->IsConstant()) {
switch (value->type) {
case INT8_TYPE:
@@ -131,7 +130,7 @@ void HIRBuilder::DumpValue(StringBuffer* str, Value* value) {
}
}
void HIRBuilder::DumpOp(StringBuffer* str, OpcodeSignatureType sig_type,
void HIRBuilder::DumpOp(poly::StringBuffer* str, OpcodeSignatureType sig_type,
Instr::Op* op) {
switch (sig_type) {
case OPCODE_SIG_TYPE_X:
@@ -158,7 +157,7 @@ void HIRBuilder::DumpOp(StringBuffer* str, OpcodeSignatureType sig_type,
}
}
void HIRBuilder::Dump(StringBuffer* str) {
void HIRBuilder::Dump(poly::StringBuffer* str) {
SCOPE_profile_cpu_f("alloy");
if (attributes_) {
@@ -1910,12 +1909,12 @@ Value* HIRBuilder::Pack(Value* value1, Value* value2, uint32_t pack_flags) {
ASSERT_VECTOR_TYPE(value1);
ASSERT_VECTOR_TYPE(value2);
switch (pack_flags & PACK_TYPE_MODE) {
case PACK_TYPE_D3DCOLOR:
case PACK_TYPE_FLOAT16_2:
case PACK_TYPE_FLOAT16_4:
case PACK_TYPE_SHORT_2:
assert_true(value2->IsConstantZero());
break;
case PACK_TYPE_D3DCOLOR:
case PACK_TYPE_FLOAT16_2:
case PACK_TYPE_FLOAT16_4:
case PACK_TYPE_SHORT_2:
assert_true(value2->IsConstantZero());
break;
}
Instr* i = AppendInstr(OPCODE_PACK_info, pack_flags, AllocValue(VEC128_TYPE));
i->set_src1(value1);

View File

@@ -17,10 +17,8 @@
#include "alloy/hir/label.h"
#include "alloy/hir/opcodes.h"
#include "alloy/hir/value.h"
namespace alloy {
class StringBuffer;
} // namespace alloy
#include "poly/arena.h"
#include "poly/string_buffer.h"
namespace alloy {
namespace hir {
@@ -37,10 +35,10 @@ class HIRBuilder {
virtual void Reset();
virtual int Finalize();
void Dump(StringBuffer* str);
void Dump(poly::StringBuffer* str);
void AssertNoCycles();
Arena* arena() const { return arena_; }
poly::Arena* arena() const { return arena_; }
uint32_t attributes() const { return attributes_; }
void set_attributes(uint32_t value) { attributes_ = value; }
@@ -230,8 +228,9 @@ class HIRBuilder {
Value* AtomicSub(Value* address, Value* value);
protected:
void DumpValue(StringBuffer* str, Value* value);
void DumpOp(StringBuffer* str, OpcodeSignatureType sig_type, Instr::Op* op);
void DumpValue(poly::StringBuffer* str, Value* value);
void DumpOp(poly::StringBuffer* str, OpcodeSignatureType sig_type,
Instr::Op* op);
Value* AllocValue(TypeName type = INT64_TYPE);
Value* CloneValue(Value* source);
@@ -246,7 +245,7 @@ class HIRBuilder {
TypeName part_type);
protected:
Arena* arena_;
poly::Arena* arena_;
uint32_t attributes_;

View File

@@ -14,7 +14,7 @@
namespace alloy {
namespace hir {
Value::Use* Value::AddUse(Arena* arena, Instr* instr) {
Value::Use* Value::AddUse(poly::Arena* arena, Instr* instr) {
Use* use = arena->Alloc<Use>();
use->instr = instr;
use->prev = NULL;

View File

@@ -10,17 +10,19 @@
#ifndef ALLOY_HIR_VALUE_H_
#define ALLOY_HIR_VALUE_H_
#include "alloy/arena.h"
#include "alloy/backend/machine_info.h"
#include "alloy/hir/opcodes.h"
#include "alloy/vec128.h"
#include "poly/arena.h"
#include "poly/poly.h"
#include "poly/vec128.h"
namespace alloy {
namespace hir {
class Instr;
using vec128_t = poly::vec128_t;
enum TypeName {
// Many tables rely on this ordering.
INT8_TYPE = 0,
@@ -99,7 +101,7 @@ class Value {
// TODO(benvanik): remove to shrink size.
void* tag;
Use* AddUse(Arena* arena, Instr* instr);
Use* AddUse(poly::Arena* arena, Instr* instr);
void RemoveUse(Use* use);
int8_t get_constant(int8_t) const { return constant.i8; }