Fix clang warnings / move some plat code into poly.

This commit is contained in:
Ben Vanik
2014-07-10 22:51:27 -07:00
parent 7daa85179c
commit 9031d5f4a4
41 changed files with 347 additions and 218 deletions

View File

@@ -430,6 +430,10 @@ int ConstantPropagationPass::Run(HIRBuilder* builder) {
// Quite a few of these, from building vec128s.
}
break;
default:
// Ignored.
break;
}
i = i->next;
}

View File

@@ -31,7 +31,7 @@ using alloy::hir::Instr;
using alloy::hir::Value;
ContextPromotionPass::ContextPromotionPass()
: context_values_size_(0), context_values_(0), CompilerPass() {}
: CompilerPass(), context_values_size_(0), context_values_(0) {}
ContextPromotionPass::~ContextPromotionPass() {
if (context_values_) {

View File

@@ -13,11 +13,15 @@
#include <alloy/compiler/compiler.h>
#include <alloy/runtime/runtime.h>
#if XE_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4267)
#include <llvm/ADT/BitVector.h>
#pragma warning(pop)
#else
#include <llvm/ADT/BitVector.h>
#endif // XE_COMPILER_MSVC
namespace alloy {
namespace compiler {

View File

@@ -153,9 +153,9 @@ void DeadCodeEliminationPass::MakeNopRecursive(Instr* i) {
#define MAKE_NOP_SRC(n) \
if (i->src##n##_use) { \
Value::Use* use = i->src##n##_use; \
Value* value = i->src##n##.value; \
Value* value = i->src##n.value; \
i->src##n##_use = NULL; \
i->src##n##.value = NULL; \
i->src##n.value = NULL; \
value->RemoveUse(use); \
if (!value->use_head) { \
/* Value is now unused, so recursively kill it. */ \
@@ -192,7 +192,6 @@ void DeadCodeEliminationPass::ReplaceAssignment(Instr* i) {
}
bool DeadCodeEliminationPass::CheckLocalUse(Instr* i) {
auto slot = i->src1.value;
auto src = i->src2.value;
auto use = src->use_head;

View File

@@ -29,7 +29,7 @@ using alloy::hir::Value;
#define ASSERT_NO_CYCLES 0
RegisterAllocationPass::RegisterAllocationPass(const MachineInfo* machine_info)
: machine_info_(machine_info), CompilerPass() {
: CompilerPass() {
// Initialize register sets.
// TODO(benvanik): rewrite in a way that makes sense - this is terrible.
auto mi_sets = machine_info->register_sets;
@@ -301,11 +301,11 @@ bool RegisterAllocationPass::TryAllocateRegister(Value* value) {
// Find the first free register, if any.
// We have to ensure it's a valid one (in our count).
unsigned long first_unused = 0;
bool all_used =
_BitScanForward(&first_unused, usage_set->availability.to_ulong()) == 0;
if (!all_used && first_unused < usage_set->count) {
// Available! Use it!.
uint32_t first_unused = 0;
bool none_used = poly::bit_scan_forward(
static_cast<uint32_t>(usage_set->availability.to_ulong()), &first_unused);
if (none_used && first_unused < usage_set->count) {
// Available! Use it!
value->reg.set = usage_set->set;
value->reg.index = first_unused;
MarkRegUsed(value->reg, value, value->use_head);

View File

@@ -69,7 +69,6 @@ class RegisterAllocationPass : public CompilerPass {
void SortUsageList(hir::Value* value);
private:
const backend::MachineInfo* machine_info_;
struct {
RegisterSetUsage* int_set = nullptr;
RegisterSetUsage* float_set = nullptr;

View File

@@ -33,11 +33,13 @@ ValidationPass::~ValidationPass() {}
int ValidationPass::Run(HIRBuilder* builder) {
SCOPE_profile_cpu_f("alloy");
#if 0
StringBuffer str;
builder->Dump(&str);
printf(str.GetString());
fflush(stdout);
str.Reset();
#endif // 0
auto block = builder->first_block();
while (block) {

View File

@@ -13,11 +13,15 @@
#include <alloy/compiler/compiler.h>
#include <alloy/runtime/runtime.h>
#if XE_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4267)
#include <llvm/ADT/BitVector.h>
#pragma warning(pop)
#else
#include <llvm/ADT/BitVector.h>
#endif // XE_COMPILER_MSVC
namespace alloy {
namespace compiler {