Fix various warnings / build issues on Windows

This commit is contained in:
Matt Pharr
2011-12-15 12:06:38 -08:00
parent 8d1b77b235
commit e82a720223
7 changed files with 14 additions and 13 deletions

View File

@@ -8,7 +8,6 @@ REM Both the LLVM binaries and python need to be in the path
set path=%LLVM_INSTALL_DIR%\bin;%PATH%;c:\cygwin\bin
msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release
msbuild ispc_test.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release
msbuild examples\examples.sln /V:m /p:Platform=x64 /p:Configuration=Release /t:rebuild
msbuild examples\examples.sln /V:m /p:Platform=x64 /p:Configuration=Debug /t:rebuild

View File

@@ -215,7 +215,7 @@ Target::SupportedTargetArchs() {
const char *
Target::SupportedTargetISAs() {
return "sse2, sse2-x2, sse4, sse4-x2"
#ifndef LLVM_2.9
#ifndef LLVM_2_9
", avx, avx-x2"
#endif !LLVM_2_9
#ifdef LLVM_3_1svn
@@ -313,7 +313,7 @@ Target::SizeOf(LLVM_TYPE_CONST llvm::Type *type) {
Assert(td != NULL);
uint64_t byteSize = td->getTypeSizeInBits(type) / 8;
if (is32Bit || g->opt.force32BitAddressing)
return LLVMInt32(byteSize);
return LLVMInt32((int32_t)byteSize);
else
return LLVMInt64(byteSize);
}
@@ -331,7 +331,7 @@ Target::StructOffset(LLVM_TYPE_CONST llvm::Type *type, int element) {
uint64_t offset = sl->getElementOffset(element);
if (is32Bit || g->opt.force32BitAddressing)
return LLVMInt32(offset);
return LLVMInt32((int32_t)offset);
else
return LLVMInt64(offset);
}

4
lex.ll
View File

@@ -184,12 +184,12 @@ L?\"(\\.|[^\\"])*\" { lStringConst(yylval, yylloc); return TOKEN_STRING_LITERAL;
{FLOAT_NUMBER} {
yylval->floatVal = atof(yytext);
yylval->floatVal = (float)atof(yytext);
return TOKEN_FLOAT_CONSTANT;
}
{HEX_FLOAT_NUMBER} {
yylval->floatVal = lParseHexFloat(yytext);
yylval->floatVal = (float)lParseHexFloat(yytext);
return TOKEN_FLOAT_CONSTANT;
}

View File

@@ -206,7 +206,7 @@ int main(int Argc, char *Argv[]) {
if (atoi(argv[i] + 13) == 64)
g->opt.force32BitAddressing = false;
else if (atoi(argv[i] + 13) == 32)
g->opt.force32BitAddressing = 32;
g->opt.force32BitAddressing = true;
else {
fprintf(stderr, "Addressing width \"%s\" invalid--only 32 and "
"64 are allowed.\n", argv[i]+13);

View File

@@ -1673,7 +1673,8 @@ lCheckMulForLinear(llvm::Value *op0, llvm::Value *op1, int vectorLength,
// Check to see if the other operand is a linear vector with stride
// given by stride/splatVal.
return lVectorIsLinear(op1, vectorLength, stride / splatVal, seenPhis);
return lVectorIsLinear(op1, vectorLength, (int)(stride / splatVal),
seenPhis);
}

View File

@@ -544,7 +544,7 @@ declaration_specifiers
| soa_width_specifier
{
DeclSpecs *ds = new DeclSpecs;
ds->soaWidth = $1;
ds->soaWidth = (int32_t)$1;
$$ = ds;
}
| soa_width_specifier declaration_specifiers
@@ -554,7 +554,7 @@ declaration_specifiers
if (ds->soaWidth != 0)
Error(@1, "soa<> qualifier supplied multiple times in declaration.");
else
ds->soaWidth = $1;
ds->soaWidth = (int32_t)$1;
}
$$ = ds;
}
@@ -565,7 +565,7 @@ declaration_specifiers
| type_specifier '<' int_constant '>'
{
DeclSpecs *ds = new DeclSpecs($1);
ds->vectorSize = $3;
ds->vectorSize = (int32_t)$3;
$$ = ds;
}
| type_specifier declaration_specifiers
@@ -651,7 +651,7 @@ short_vec_specifier
: atomic_var_type_specifier '<' int_constant '>'
{
Type* vt =
new VectorType($1, $3);
new VectorType($1, (int32_t)$3);
$$ = vt;
}
;

View File

@@ -43,6 +43,7 @@
#include <windows.h>
#endif // ISPC_IS_WINDOWS
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
@@ -102,7 +103,7 @@ void *ISPCAlloc(void **handle, int64_t size, int32_t alignment) {
int main(int argc, char *argv[]) {
int w = width();
Assert(w <= 16);
assert(w <= 16);
float returned_result[16];
for (int i = 0; i < 16; ++i)