Merge branch 'master' into nvptx

This commit is contained in:
Evghenii
2014-03-19 10:53:07 +01:00
93 changed files with 1182 additions and 1536 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2010-2013, Intel Corporation
Copyright (c) 2010-2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -74,8 +74,11 @@
#include <llvm/IR/CallingConv.h>
#endif
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/Support/InstIterator.h>
#if defined(LLVM_3_5)
#include <llvm/IR/InstIterator.h>
#else
#include <llvm/Support/InstIterator.h>
#endif
/////////////////////////////////////////////////////////////////////////////////////
// Expr
@@ -206,14 +209,14 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr,
if (Type::Equal(toType, fromType))
return true;
if (Type::Equal(fromType, AtomicType::Void)) {
if (fromType->IsVoidType()) {
if (!failureOk)
Error(pos, "Can't convert from \"void\" to \"%s\" for %s.",
toType->GetString().c_str(), errorMsgBase);
return false;
}
if (Type::Equal(toType, AtomicType::Void)) {
if (toType->IsVoidType()) {
if (!failureOk)
Error(pos, "Can't convert type \"%s\" to \"void\" for %s.",
fromType->GetString().c_str(), errorMsgBase);
@@ -339,7 +342,8 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr,
return false;
}
else if (PointerType::IsVoidPointer(toPointerType)) {
if (fromPointerType->GetBaseType()->IsConstType()) {
if (fromPointerType->GetBaseType()->IsConstType() &&
!(toPointerType->GetBaseType()->IsConstType())) {
if (!failureOk)
Error(pos, "Can't convert pointer to const \"%s\" to void pointer.",
fromPointerType->GetString().c_str());
@@ -3608,7 +3612,7 @@ FunctionCallExpr::GetValue(FunctionEmitContext *ctx) const {
const FunctionType *ft = lGetFunctionType(func);
AssertPos(pos, ft != NULL);
bool isVoidFunc = Type::Equal(ft->GetReturnType(), AtomicType::Void);
bool isVoidFunc = ft->GetReturnType()->IsVoidType();
// Automatically convert function call args to references if needed.
// FIXME: this should move to the TypeCheck() method... (but the
@@ -3895,7 +3899,7 @@ FunctionCallExpr::TypeCheck() {
if (fptrType->IsVaryingType()) {
const Type *retType = funcType->GetReturnType();
if (Type::Equal(retType, AtomicType::Void) == false &&
if (retType->IsVoidType() == false &&
retType->IsUniformType()) {
Error(pos, "Illegal to call a varying function pointer that "
"points to a function with a uniform return type \"%s\".",
@@ -4603,7 +4607,7 @@ IndexExpr::TypeCheck() {
if (!CastType<SequentialType>(baseExprType->GetReferenceTarget())) {
if (const PointerType *pt = CastType<PointerType>(baseExprType)) {
if (Type::Equal(AtomicType::Void, pt->GetBaseType())) {
if (pt->GetBaseType()->IsVoidType()) {
Error(pos, "Illegal to dereference void pointer type \"%s\".",
baseExprType->GetString().c_str());
return NULL;
@@ -6194,10 +6198,10 @@ ConstExpr::Print() const {
printf("%f", floatVal[i]);
break;
case AtomicType::TYPE_INT64:
printf("%"PRId64, int64Val[i]);
printf("%" PRId64, int64Val[i]);
break;
case AtomicType::TYPE_UINT64:
printf("%"PRIu64, uint64Val[i]);
printf("%" PRIu64, uint64Val[i]);
break;
case AtomicType::TYPE_DOUBLE:
printf("%f", doubleVal[i]);
@@ -6797,7 +6801,7 @@ TypeCastExpr::GetValue(FunctionEmitContext *ctx) const {
return NULL;
}
if (Type::Equal(toType, AtomicType::Void)) {
if (toType->IsVoidType()) {
// emit the code for the expression in case it has side-effects but
// then we're done.
(void)expr->GetValue(ctx);
@@ -7160,10 +7164,10 @@ TypeCastExpr::TypeCheck() {
toType = lDeconstifyType(toType);
// Anything can be cast to void...
if (Type::Equal(toType, AtomicType::Void))
if (toType->IsVoidType())
return this;
if (Type::Equal(fromType, AtomicType::Void) ||
if (fromType->IsVoidType() ||
(fromType->IsVaryingType() && toType->IsUniformType())) {
Error(pos, "Can't type cast from type \"%s\" to type \"%s\"",
fromType->GetString().c_str(), toType->GetString().c_str());
@@ -7586,7 +7590,7 @@ PtrDerefExpr::TypeCheck() {
}
if (const PointerType *pt = CastType<PointerType>(type)) {
if (Type::Equal(AtomicType::Void, pt->GetBaseType())) {
if (pt->GetBaseType()->IsVoidType()) {
Error(pos, "Illegal to dereference void pointer type \"%s\".",
type->GetString().c_str());
return NULL;