Fixing some particularly bad /W4.
This commit is contained in:
@@ -388,7 +388,7 @@ void HIRBuilder::InsertLabel(Label* label, Instr* prev_instr) {
|
||||
Block* next_block = prev_instr->block->next;
|
||||
|
||||
Block* new_block = arena_->Alloc<Block>();
|
||||
new_block->ordinal = -1;
|
||||
new_block->ordinal = UINT16_MAX;
|
||||
new_block->incoming_values = nullptr;
|
||||
new_block->arena = arena_;
|
||||
new_block->prev = prev_block;
|
||||
@@ -466,10 +466,10 @@ void HIRBuilder::AddEdge(Block* src, Block* dest, uint32_t flags) {
|
||||
|
||||
if (dest_was_dominated) {
|
||||
// If dest was previously dominated it no longer is.
|
||||
auto edge = dest->incoming_edge_head;
|
||||
while (edge) {
|
||||
edge->flags &= ~Edge::DOMINATES;
|
||||
edge = edge->incoming_next;
|
||||
auto incoming_edge = dest->incoming_edge_head;
|
||||
while (incoming_edge) {
|
||||
incoming_edge->flags &= ~Edge::DOMINATES;
|
||||
incoming_edge = incoming_edge->incoming_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,7 +633,7 @@ void HIRBuilder::MergeAdjacentBlocks(Block* left, Block* right) {
|
||||
|
||||
Block* HIRBuilder::AppendBlock() {
|
||||
Block* block = arena_->Alloc<Block>();
|
||||
block->ordinal = -1;
|
||||
block->ordinal = UINT16_MAX;
|
||||
block->incoming_values = nullptr;
|
||||
block->arena = arena_;
|
||||
block->next = NULL;
|
||||
@@ -690,7 +690,7 @@ Instr* HIRBuilder::AppendInstr(const OpcodeInfo& opcode_info, uint16_t flags,
|
||||
if (!block->instr_head) {
|
||||
block->instr_head = instr;
|
||||
}
|
||||
instr->ordinal = -1;
|
||||
instr->ordinal = UINT32_MAX;
|
||||
instr->block = block;
|
||||
instr->opcode = &opcode_info;
|
||||
instr->flags = flags;
|
||||
@@ -824,7 +824,7 @@ void HIRBuilder::TrapTrue(Value* cond, uint16_t trap_code) {
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::Call(FunctionInfo* symbol_info, uint32_t call_flags) {
|
||||
void HIRBuilder::Call(FunctionInfo* symbol_info, uint16_t call_flags) {
|
||||
Instr* i = AppendInstr(OPCODE_CALL_info, call_flags);
|
||||
i->src1.symbol_info = symbol_info;
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
@@ -832,7 +832,7 @@ void HIRBuilder::Call(FunctionInfo* symbol_info, uint32_t call_flags) {
|
||||
}
|
||||
|
||||
void HIRBuilder::CallTrue(Value* cond, FunctionInfo* symbol_info,
|
||||
uint32_t call_flags) {
|
||||
uint16_t call_flags) {
|
||||
if (cond->IsConstant()) {
|
||||
if (cond->IsConstantTrue()) {
|
||||
Call(symbol_info, call_flags);
|
||||
@@ -847,7 +847,7 @@ void HIRBuilder::CallTrue(Value* cond, FunctionInfo* symbol_info,
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::CallIndirect(Value* value, uint32_t call_flags) {
|
||||
void HIRBuilder::CallIndirect(Value* value, uint16_t call_flags) {
|
||||
ASSERT_CALL_ADDRESS_TYPE(value);
|
||||
Instr* i = AppendInstr(OPCODE_CALL_INDIRECT_info, call_flags);
|
||||
i->set_src1(value);
|
||||
@@ -856,7 +856,7 @@ void HIRBuilder::CallIndirect(Value* value, uint32_t call_flags) {
|
||||
}
|
||||
|
||||
void HIRBuilder::CallIndirectTrue(Value* cond, Value* value,
|
||||
uint32_t call_flags) {
|
||||
uint16_t call_flags) {
|
||||
if (cond->IsConstant()) {
|
||||
if (cond->IsConstantTrue()) {
|
||||
CallIndirect(value, call_flags);
|
||||
@@ -907,14 +907,14 @@ void HIRBuilder::SetReturnAddress(Value* value) {
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
}
|
||||
|
||||
void HIRBuilder::Branch(Label* label, uint32_t branch_flags) {
|
||||
void HIRBuilder::Branch(Label* label, uint16_t branch_flags) {
|
||||
Instr* i = AppendInstr(OPCODE_BRANCH_info, branch_flags);
|
||||
i->src1.label = label;
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::Branch(Block* block, uint32_t branch_flags) {
|
||||
void HIRBuilder::Branch(Block* block, uint16_t branch_flags) {
|
||||
if (!block->label_head) {
|
||||
// Block needs a label.
|
||||
Label* label = NewLabel();
|
||||
@@ -923,7 +923,7 @@ void HIRBuilder::Branch(Block* block, uint32_t branch_flags) {
|
||||
Branch(block->label_head, branch_flags);
|
||||
}
|
||||
|
||||
void HIRBuilder::BranchTrue(Value* cond, Label* label, uint32_t branch_flags) {
|
||||
void HIRBuilder::BranchTrue(Value* cond, Label* label, uint16_t branch_flags) {
|
||||
if (cond->IsConstant()) {
|
||||
if (cond->IsConstantTrue()) {
|
||||
Branch(label, branch_flags);
|
||||
@@ -938,7 +938,7 @@ void HIRBuilder::BranchTrue(Value* cond, Label* label, uint32_t branch_flags) {
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::BranchFalse(Value* cond, Label* label, uint32_t branch_flags) {
|
||||
void HIRBuilder::BranchFalse(Value* cond, Label* label, uint16_t branch_flags) {
|
||||
if (cond->IsConstant()) {
|
||||
if (cond->IsConstantFalse()) {
|
||||
Branch(label, branch_flags);
|
||||
|
||||
@@ -83,20 +83,20 @@ class HIRBuilder {
|
||||
void Trap(uint16_t trap_code = 0);
|
||||
void TrapTrue(Value* cond, uint16_t trap_code = 0);
|
||||
|
||||
void Call(FunctionInfo* symbol_info, uint32_t call_flags = 0);
|
||||
void Call(FunctionInfo* symbol_info, uint16_t call_flags = 0);
|
||||
void CallTrue(Value* cond, FunctionInfo* symbol_info,
|
||||
uint32_t call_flags = 0);
|
||||
void CallIndirect(Value* value, uint32_t call_flags = 0);
|
||||
void CallIndirectTrue(Value* cond, Value* value, uint32_t call_flags = 0);
|
||||
uint16_t call_flags = 0);
|
||||
void CallIndirect(Value* value, uint16_t call_flags = 0);
|
||||
void CallIndirectTrue(Value* cond, Value* value, uint16_t call_flags = 0);
|
||||
void CallExtern(FunctionInfo* symbol_info);
|
||||
void Return();
|
||||
void ReturnTrue(Value* cond);
|
||||
void SetReturnAddress(Value* value);
|
||||
|
||||
void Branch(Label* label, uint32_t branch_flags = 0);
|
||||
void Branch(Block* block, uint32_t branch_flags = 0);
|
||||
void BranchTrue(Value* cond, Label* label, uint32_t branch_flags = 0);
|
||||
void BranchFalse(Value* cond, Label* label, uint32_t branch_flags = 0);
|
||||
void Branch(Label* label, uint16_t branch_flags = 0);
|
||||
void Branch(Block* block, uint16_t branch_flags = 0);
|
||||
void BranchTrue(Value* cond, Label* label, uint16_t branch_flags = 0);
|
||||
void BranchFalse(Value* cond, Label* label, uint16_t branch_flags = 0);
|
||||
|
||||
// phi type_name, Block* b1, Value* v1, Block* b2, Value* v2, etc
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ void Instr::MoveBefore(Instr* other) {
|
||||
}
|
||||
}
|
||||
|
||||
void Instr::Replace(const OpcodeInfo* opcode, uint16_t flags) {
|
||||
this->opcode = opcode;
|
||||
this->flags = flags;
|
||||
void Instr::Replace(const OpcodeInfo* new_opcode, uint16_t new_flags) {
|
||||
opcode = new_opcode;
|
||||
flags = new_flags;
|
||||
|
||||
if (src1_use) {
|
||||
src1.value->RemoveUse(src1_use);
|
||||
|
||||
@@ -57,7 +57,7 @@ class Instr {
|
||||
void set_src3(Value* value);
|
||||
|
||||
void MoveBefore(Instr* other);
|
||||
void Replace(const OpcodeInfo* opcode, uint16_t flags);
|
||||
void Replace(const OpcodeInfo* new_opcode, uint16_t new_flags);
|
||||
void Remove();
|
||||
};
|
||||
|
||||
|
||||
@@ -421,22 +421,22 @@ void Value::Neg() {
|
||||
void Value::Abs() {
|
||||
switch (type) {
|
||||
case INT8_TYPE:
|
||||
constant.i8 = abs(constant.i8);
|
||||
constant.i8 = int8_t(std::abs(constant.i8));
|
||||
break;
|
||||
case INT16_TYPE:
|
||||
constant.i16 = abs(constant.i16);
|
||||
constant.i16 = int16_t(std::abs(constant.i16));
|
||||
break;
|
||||
case INT32_TYPE:
|
||||
constant.i32 = abs(constant.i32);
|
||||
constant.i32 = std::abs(constant.i32);
|
||||
break;
|
||||
case INT64_TYPE:
|
||||
constant.i64 = abs(constant.i64);
|
||||
constant.i64 = std::abs(constant.i64);
|
||||
break;
|
||||
case FLOAT32_TYPE:
|
||||
constant.f32 = abs(constant.f32);
|
||||
constant.f32 = std::abs(constant.f32);
|
||||
break;
|
||||
case FLOAT64_TYPE:
|
||||
constant.f64 = abs(constant.f64);
|
||||
constant.f64 = std::abs(constant.f64);
|
||||
break;
|
||||
case VEC128_TYPE:
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -452,10 +452,10 @@ void Value::Abs() {
|
||||
void Value::Sqrt() {
|
||||
switch (type) {
|
||||
case FLOAT32_TYPE:
|
||||
constant.f32 = 1.0f / sqrtf(constant.f32);
|
||||
constant.f32 = 1.0f / std::sqrtf(constant.f32);
|
||||
break;
|
||||
case FLOAT64_TYPE:
|
||||
constant.f64 = 1.0 / sqrt(constant.f64);
|
||||
constant.f64 = 1.0 / std::sqrt(constant.f64);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(type);
|
||||
@@ -466,10 +466,10 @@ void Value::Sqrt() {
|
||||
void Value::RSqrt() {
|
||||
switch (type) {
|
||||
case FLOAT32_TYPE:
|
||||
constant.f32 = sqrt(constant.f32);
|
||||
constant.f32 = std::sqrt(constant.f32);
|
||||
break;
|
||||
case FLOAT64_TYPE:
|
||||
constant.f64 = sqrt(constant.f64);
|
||||
constant.f64 = std::sqrt(constant.f64);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(type);
|
||||
|
||||
@@ -113,8 +113,8 @@ class Value {
|
||||
double get_constant(double) const { return constant.f64; }
|
||||
vec128_t get_constant(vec128_t&) const { return constant.v128; }
|
||||
|
||||
void set_zero(TypeName type) {
|
||||
this->type = type;
|
||||
void set_zero(TypeName new_type) {
|
||||
type = new_type;
|
||||
flags |= VALUE_IS_CONSTANT;
|
||||
constant.v128.low = constant.v128.high = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user