Fixing alloy analysis warnings.

This commit is contained in:
Ben Vanik 2014-01-14 01:11:42 -08:00
parent 50587974b5
commit a02f5c3e7a
6 changed files with 11 additions and 10 deletions

View File

@ -1242,7 +1242,7 @@ static uint8_t __lvsr_table[17][16] = {
};
uint32_t IntCode_LOAD_VECTOR_SHL(IntCodeState& ics, const IntCode* i) {
int8_t sh = ics.rf[i->src1_reg].i8 & 0x1F;
int8_t sh = MIN(16, ics.rf[i->src1_reg].i8);
vec128_t& dest = ics.rf[i->dest_reg].v128;
for (int n = 0; n < 16; n++) {
dest.b16[n] = __lvsl_table[sh][n];
@ -1254,7 +1254,7 @@ int Translate_LOAD_VECTOR_SHL(TranslationContext& ctx, Instr* i) {
}
uint32_t IntCode_LOAD_VECTOR_SHR(IntCodeState& ics, const IntCode* i) {
int8_t sh = ics.rf[i->src1_reg].i8 & 0x1F;
int8_t sh = MIN(16, ics.rf[i->src1_reg].i8);
vec128_t& dest = ics.rf[i->dest_reg].v128;
for (int n = 0; n < 16; n++) {
dest.b16[n] = __lvsr_table[sh][n];

View File

@ -631,7 +631,7 @@ int InstrEmit_vcmpxxfp_(PPCHIRBuilder& f, InstrData& i, vcmpxxfp_op cmpop, uint3
break;
default:
XEASSERTALWAYS();
break;
return 1;
}
if (rc) {
f.UpdateCR6(v);

View File

@ -674,7 +674,7 @@ XEEMITTER(andisx, 0x74000000, D )(PPCHIRBuilder& f, InstrData& i) {
// RA <- (RS) & (i32.0 || UI || i16.0)
Value* ra = f.And(
f.LoadGPR(i.D.RT),
f.LoadConstant((uint64_t)(i.D.DS << 16)));
f.LoadConstant((uint64_t(i.D.DS) << 16)));
f.UpdateCR(0, ra);
f.StoreGPR(i.D.RA, ra);
return 0;
@ -839,7 +839,7 @@ XEEMITTER(oris, 0x64000000, D )(PPCHIRBuilder& f, InstrData& i) {
// RA <- (RS) | (i32.0 || UI || i16.0)
Value* ra = f.Or(
f.LoadGPR(i.D.RT),
f.LoadConstant((uint64_t)(i.D.DS << 16)));
f.LoadConstant((uint64_t(i.D.DS) << 16)));
f.StoreGPR(i.D.RA, ra);
return 0;
}
@ -869,7 +869,7 @@ XEEMITTER(xoris, 0x6C000000, D )(PPCHIRBuilder& f, InstrData& i) {
// RA <- (RS) XOR (i32.0 || UI || i16.0)
Value* ra = f.Xor(
f.LoadGPR(i.D.RT),
f.LoadConstant((uint64_t)(i.D.DS << 16)));
f.LoadConstant((uint64_t(i.D.DS) << 16)));
f.StoreGPR(i.D.RA, ra);
return 0;
}

View File

@ -149,7 +149,8 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
void PPCHIRBuilder::AnnotateLabel(uint64_t address, Label* label) {
char name_buffer[13];
xesnprintfa(name_buffer, XECOUNT(name_buffer), "loc_%.8X", address);
xesnprintfa(name_buffer, XECOUNT(name_buffer),
"loc_%.8X", (uint32_t)address);
label->name = (char*)arena_->Alloc(sizeof(name_buffer));
xe_copy_struct(label->name, name_buffer, sizeof(name_buffer));
}

View File

@ -307,7 +307,7 @@ void HIRBuilder::InsertLabel(Label* label, Instr* prev_instr) {
label->prev = label->next = NULL;
Instr* prev_next = prev_instr->next;
Instr* old_prev_tail = prev_block->instr_tail;
Instr* old_prev_tail = prev_block ? prev_block->instr_tail : NULL;
if (prev_instr->next) {
Instr* prev_last = prev_instr->next->prev;
prev_last->next = NULL;

View File

@ -20,10 +20,10 @@ namespace alloy {
Mutex* alloy::AllocMutex(uint32_t spin_count) {
Mutex* mutex = (Mutex*)calloc(1, sizeof(Mutex));
Mutex* mutex = (Mutex*)xe_calloc(sizeof(Mutex));
if (spin_count) {
InitializeCriticalSectionAndSpinCount(&mutex->value, spin_count);
XEIGNORE(InitializeCriticalSectionAndSpinCount(&mutex->value, spin_count));
} else {
InitializeCriticalSection(&mutex->value);
}