Cleaning up asserts and file/line macros.

This commit is contained in:
Ben Vanik
2014-07-12 16:51:52 -07:00
parent 840357413c
commit bf882714d0
92 changed files with 636 additions and 613 deletions

View File

@@ -277,13 +277,13 @@ int ConstantPropagationPass::Run(HIRBuilder* builder) {
break;
case OPCODE_DID_CARRY:
XEASSERT(!i->src1.value->IsConstant());
assert_true(!i->src1.value->IsConstant());
break;
case OPCODE_DID_OVERFLOW:
XEASSERT(!i->src1.value->IsConstant());
assert_true(!i->src1.value->IsConstant());
break;
case OPCODE_DID_SATURATE:
XEASSERT(!i->src1.value->IsConstant());
assert_true(!i->src1.value->IsConstant());
break;
case OPCODE_ADD:

View File

@@ -97,7 +97,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
if (v->def && v->def->block != block) { \
incoming_values.set(v->ordinal); \
} \
XEASSERT(v->ordinal < max_value_estimate); \
assert_true(v->ordinal < max_value_estimate); \
value_map[v->ordinal] = v;
if (GET_OPCODE_SIG_TYPE_SRC1(signature) == OPCODE_SIG_TYPE_V) {
SET_INCOMING_VALUE(instr->src1.value);
@@ -128,7 +128,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
auto outgoing_ordinal = outgoing_values.find_first();
while (outgoing_ordinal != -1) {
Value* src_value = value_map[outgoing_ordinal];
XEASSERTNOTNULL(src_value);
assert_not_null(src_value);
if (!src_value->local_slot) {
src_value->local_slot = builder->AllocLocal(src_value->type);
}
@@ -142,7 +142,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
while (def_next && def_next->opcode->flags & OPCODE_FLAG_PAIRED_PREV) {
def_next = def_next->next;
}
XEASSERTNOTNULL(def_next);
assert_not_null(def_next);
builder->last_instr()->MoveBefore(def_next);
// We don't need it in the incoming list.
@@ -153,7 +153,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
while (tail && tail->opcode->flags & OPCODE_FLAG_BRANCH) {
tail = tail->prev;
}
XEASSERTNOTZERO(tail);
assert_not_zero(tail);
builder->last_instr()->MoveBefore(tail->next);
}
@@ -164,7 +164,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
auto incoming_ordinal = incoming_values.find_first();
while (incoming_ordinal != -1) {
Value* src_value = value_map[incoming_ordinal];
XEASSERTNOTNULL(src_value);
assert_not_null(src_value);
if (!src_value->local_slot) {
src_value->local_slot = builder->AllocLocal(src_value->type);
}

View File

@@ -114,13 +114,13 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
// dest.
has_preferred_reg = true;
preferred_reg = instr->src1.value->reg;
XEASSERTNOTNULL(preferred_reg.set);
assert_not_null(preferred_reg.set);
}
}
if (GET_OPCODE_SIG_TYPE_DEST(signature) == OPCODE_SIG_TYPE_V) {
// Must not have been set already.
XEASSERTNULL(instr->dest->reg.set);
assert_null(instr->dest->reg.set);
// Sort the usage list. We depend on this in future uses of this
// variable.
@@ -144,7 +144,7 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
if (!SpillOneRegister(builder, instr->dest->type)) {
// Unable to spill anything - this shouldn't happen.
XELOGE("Unable to spill any registers");
XEASSERTALWAYS();
assert_always();
return 1;
}
@@ -152,7 +152,7 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
if (!TryAllocateRegister(instr->dest)) {
// Boned.
XELOGE("Register allocation failed");
XEASSERTALWAYS();
assert_always();
return 1;
}
}
@@ -330,14 +330,14 @@ bool RegisterAllocationPass::SpillOneRegister(HIRBuilder* builder,
DumpUsage("SpillOneRegister (pre)");
// Pick the one with the furthest next use.
XEASSERT(!usage_set->upcoming_uses.empty());
assert_true(!usage_set->upcoming_uses.empty());
auto furthest_usage = std::max_element(usage_set->upcoming_uses.begin(),
usage_set->upcoming_uses.end(),
RegisterUsage::Comparer());
auto spill_value = furthest_usage->value;
Value::Use* prev_use = furthest_usage->use->prev;
Value::Use* next_use = furthest_usage->use;
XEASSERTNOTNULL(next_use);
assert_not_null(next_use);
usage_set->upcoming_uses.erase(furthest_usage);
DumpUsage("SpillOneRegister (post)");
const auto reg = spill_value->reg;
@@ -361,11 +361,11 @@ bool RegisterAllocationPass::SpillOneRegister(HIRBuilder* builder,
builder->StoreLocal(spill_value->local_slot, spill_value);
auto spill_store = builder->last_instr();
auto spill_store_use = spill_store->src2_use;
XEASSERTNULL(spill_store_use->prev);
assert_null(spill_store_use->prev);
if (prev_use && prev_use->instr->opcode->flags & OPCODE_FLAG_PAIRED_PREV) {
// Instruction is paired. This is bad. We will insert the spill after the
// paired instruction.
XEASSERTNOTNULL(prev_use->instr->next);
assert_not_null(prev_use->instr->next);
spill_store->MoveBefore(prev_use->instr->next);
// Update last use.

View File

@@ -45,7 +45,7 @@ int ValidationPass::Run(HIRBuilder* builder) {
while (block) {
auto label = block->label_head;
while (label) {
XEASSERT(label->block == block);
assert_true(label->block == block);
if (label->block != block) {
return 1;
}
@@ -67,7 +67,7 @@ int ValidationPass::Run(HIRBuilder* builder) {
}
int ValidationPass::ValidateInstruction(Block* block, Instr* instr) {
XEASSERT(instr->block == block);
assert_true(instr->block == block);
if (instr->block != block) {
return 1;
}
@@ -95,7 +95,7 @@ int ValidationPass::ValidateInstruction(Block* block, Instr* instr) {
int ValidationPass::ValidateValue(Block* block, Instr* instr, Value* value) {
// if (value->def) {
// auto def = value->def;
// XEASSERT(def->block == block);
// assert_true(def->block == block);
// if (def->block != block) {
// return 1;
// }