Commit 113e33ac by Alexis Hetu Committed by Alexis Hétu

Fixed warnings in Reactor

Fixed: - type comparison mismatch - redefined macros - unused functions - line endings Change-Id: I965ca4b887aee968e6cf95feb36c3cbf90b85580 Reviewed-on: https://swiftshader-review.googlesource.com/8528Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 7a53aa91
...@@ -135,7 +135,7 @@ namespace ...@@ -135,7 +135,7 @@ namespace
for(Ice::Inst *use : uses[loadData]) for(Ice::Inst *use : uses[loadData])
{ {
for(int i = 0; i < use->getSrcSize(); i++) for(Ice::SizeT i = 0; i < use->getSrcSize(); i++)
{ {
if(use->getSrc(i) == loadData) if(use->getSrc(i) == loadData)
{ {
...@@ -201,7 +201,7 @@ namespace ...@@ -201,7 +201,7 @@ namespace
replace(load, storeValue); replace(load, storeValue);
for(int i = 0; i < addressUses.loads.size(); i++) for(size_t i = 0; i < addressUses.loads.size(); i++)
{ {
if(addressUses.loads[i] == load) if(addressUses.loads[i] == load)
{ {
...@@ -211,7 +211,7 @@ namespace ...@@ -211,7 +211,7 @@ namespace
} }
} }
for(int i = 0; i < addressUses.size(); i++) for(size_t i = 0; i < addressUses.size(); i++)
{ {
if(addressUses[i] == load) if(addressUses[i] == load)
{ {
...@@ -231,7 +231,7 @@ namespace ...@@ -231,7 +231,7 @@ namespace
auto &valueUses = uses[storeValue]; auto &valueUses = uses[storeValue];
for(int i = 0; i < valueUses.size(); i++) for(size_t i = 0; i < valueUses.size(); i++)
{ {
if(valueUses[i] == store) if(valueUses[i] == store)
{ {
...@@ -280,7 +280,7 @@ namespace ...@@ -280,7 +280,7 @@ namespace
Ice::CfgNode *singleBasicBlock = node[addressUses.stores[0]]; Ice::CfgNode *singleBasicBlock = node[addressUses.stores[0]];
for(int i = 1; i < addressUses.stores.size(); i++) for(size_t i = 1; i < addressUses.stores.size(); i++)
{ {
Ice::Inst *store = addressUses.stores[i]; Ice::Inst *store = addressUses.stores[i];
if(node[store] != singleBasicBlock) if(node[store] != singleBasicBlock)
...@@ -356,9 +356,9 @@ namespace ...@@ -356,9 +356,9 @@ namespace
node[&instruction] = basicBlock; node[&instruction] = basicBlock;
definition[instruction.getDest()] = &instruction; definition[instruction.getDest()] = &instruction;
for(int i = 0; i < instruction.getSrcSize(); i++) for(Ice::SizeT i = 0; i < instruction.getSrcSize(); i++)
{ {
int unique = 0; Ice::SizeT unique = 0;
for(; unique < i; unique++) for(; unique < i; unique++)
{ {
if(instruction.getSrc(i) == instruction.getSrc(unique)) if(instruction.getSrc(i) == instruction.getSrc(unique))
...@@ -390,7 +390,7 @@ namespace ...@@ -390,7 +390,7 @@ namespace
{ {
assert(!use->isDeleted()); // Should have been removed from uses already assert(!use->isDeleted()); // Should have been removed from uses already
for(int i = 0; i < use->getSrcSize(); i++) for(Ice::SizeT i = 0; i < use->getSrcSize(); i++)
{ {
if(use->getSrc(i) == oldValue) if(use->getSrc(i) == oldValue)
{ {
...@@ -415,7 +415,7 @@ namespace ...@@ -415,7 +415,7 @@ namespace
instruction->setDeleted(); instruction->setDeleted();
for(int i = 0; i < instruction->getSrcSize(); i++) for(Ice::SizeT i = 0; i < instruction->getSrcSize(); i++)
{ {
Ice::Operand *src = instruction->getSrc(i); Ice::Operand *src = instruction->getSrc(i);
...@@ -583,14 +583,14 @@ namespace ...@@ -583,14 +583,14 @@ namespace
{ {
auto &uses = *this; auto &uses = *this;
for(int i = 0; i < uses.size(); i++) for(size_t i = 0; i < uses.size(); i++)
{ {
if(uses[i] == instruction) if(uses[i] == instruction)
{ {
uses[i] = back(); uses[i] = back();
pop_back(); pop_back();
for(int i = 0; i < loads.size(); i++) for(size_t i = 0; i < loads.size(); i++)
{ {
if(loads[i] == instruction) if(loads[i] == instruction)
{ {
...@@ -600,7 +600,7 @@ namespace ...@@ -600,7 +600,7 @@ namespace
} }
} }
for(int i = 0; i < stores.size(); i++) for(size_t i = 0; i < stores.size(); i++)
{ {
if(stores[i] == instruction) if(stores[i] == instruction)
{ {
......
...@@ -31,8 +31,12 @@ ...@@ -31,8 +31,12 @@
#include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_os_ostream.h"
#if defined(_WIN32) #if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif // !WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif // !NOMINMAX
#include <Windows.h> #include <Windows.h>
#else #else
#include <sys/mman.h> #include <sys/mman.h>
...@@ -109,7 +113,7 @@ namespace sw ...@@ -109,7 +113,7 @@ namespace sw
Ice::Type T(Type *t) Ice::Type T(Type *t)
{ {
static_assert(Ice::IceType_NUM < EmulatedBits, "Ice::Type overlaps with our emulated types!"); static_assert(static_cast<unsigned int>(Ice::IceType_NUM) < static_cast<unsigned int>(EmulatedBits), "Ice::Type overlaps with our emulated types!");
return (Ice::Type)(reinterpret_cast<std::intptr_t>(t) & ~EmulatedBits); return (Ice::Type)(reinterpret_cast<std::intptr_t>(t) & ~EmulatedBits);
} }
...@@ -292,20 +296,20 @@ namespace sw ...@@ -292,20 +296,20 @@ namespace sw
{ {
assert(sizeof(void*) == 4 && "UNIMPLEMENTED"); // Only expected/implemented for 32-bit code assert(sizeof(void*) == 4 && "UNIMPLEMENTED"); // Only expected/implemented for 32-bit code
for(int index = 0; index < sectionHeader[i].sh_size / sectionHeader[i].sh_entsize; index++) for(Elf32_Word index = 0; index < sectionHeader[i].sh_size / sectionHeader[i].sh_entsize; index++)
{ {
const Elf32_Rel &relocation = ((const Elf32_Rel*)(elfImage + sectionHeader[i].sh_offset))[index]; const Elf32_Rel &relocation = ((const Elf32_Rel*)(elfImage + sectionHeader[i].sh_offset))[index];
void *symbol = relocateSymbol(elfHeader, relocation, sectionHeader[i]); relocateSymbol(elfHeader, relocation, sectionHeader[i]);
} }
} }
else if(sectionHeader[i].sh_type == SHT_RELA) else if(sectionHeader[i].sh_type == SHT_RELA)
{ {
assert(sizeof(void*) == 8 && "UNIMPLEMENTED"); // Only expected/implemented for 64-bit code assert(sizeof(void*) == 8 && "UNIMPLEMENTED"); // Only expected/implemented for 64-bit code
for(int index = 0; index < sectionHeader[i].sh_size / sectionHeader[i].sh_entsize; index++) for(Elf32_Word index = 0; index < sectionHeader[i].sh_size / sectionHeader[i].sh_entsize; index++)
{ {
const Elf64_Rela &relocation = ((const Elf64_Rela*)(elfImage + sectionHeader[i].sh_offset))[index]; const Elf64_Rela &relocation = ((const Elf64_Rela*)(elfImage + sectionHeader[i].sh_offset))[index];
void *symbol = relocateSymbol(elfHeader, relocation, sectionHeader[i]); relocateSymbol(elfHeader, relocation, sectionHeader[i]);
} }
} }
} }
...@@ -683,15 +687,6 @@ namespace sw ...@@ -683,15 +687,6 @@ namespace sw
return createArithmetic(Ice::InstArithmetic::Xor, lhs, rhs); return createArithmetic(Ice::InstArithmetic::Xor, lhs, rhs);
} }
static Ice::Variable *createAssign(Ice::Operand *constant)
{
Ice::Variable *value = ::function->makeVariable(constant->getType());
auto assign = Ice::InstAssign::create(::function, value, constant);
::basicBlock->appendInst(assign);
return value;
}
Value *Nucleus::createNeg(Value *v) Value *Nucleus::createNeg(Value *v)
{ {
return createSub(createNullValue(T(v->getType())), v); return createSub(createNullValue(T(v->getType())), v);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment