remove trailing whitespace
This commit is contained in:
2
ast.cpp
2
ast.cpp
@@ -497,7 +497,7 @@ lCheckAllOffSafety(ASTNode *node, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Don't allow turning if/else to straight-line-code if we
|
Don't allow turning if/else to straight-line-code if we
|
||||||
assign to a uniform.
|
assign to a uniform.
|
||||||
*/
|
*/
|
||||||
AssignExpr *ae;
|
AssignExpr *ae;
|
||||||
|
|||||||
12
expr.cpp
12
expr.cpp
@@ -3204,7 +3204,7 @@ static llvm::Value *
|
|||||||
lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test,
|
lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test,
|
||||||
llvm::Value *expr1, llvm::Value *expr2,
|
llvm::Value *expr1, llvm::Value *expr2,
|
||||||
const Type *type) {
|
const Type *type) {
|
||||||
|
|
||||||
llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp");
|
llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp");
|
||||||
// Don't need to worry about masking here
|
// Don't need to worry about masking here
|
||||||
ctx->StoreInst(expr2, resultPtr);
|
ctx->StoreInst(expr2, resultPtr);
|
||||||
@@ -3704,7 +3704,7 @@ FunctionCallExpr::GetValue(FunctionEmitContext *ctx) const {
|
|||||||
ctx->SetDebugPos(pos);
|
ctx->SetDebugPos(pos);
|
||||||
if (ft->isTask) {
|
if (ft->isTask) {
|
||||||
AssertPos(pos, launchCountExpr[0] != NULL);
|
AssertPos(pos, launchCountExpr[0] != NULL);
|
||||||
llvm::Value *launchCount[3] =
|
llvm::Value *launchCount[3] =
|
||||||
{ launchCountExpr[0]->GetValue(ctx),
|
{ launchCountExpr[0]->GetValue(ctx),
|
||||||
launchCountExpr[1]->GetValue(ctx),
|
launchCountExpr[1]->GetValue(ctx),
|
||||||
launchCountExpr[2]->GetValue(ctx) };
|
launchCountExpr[2]->GetValue(ctx) };
|
||||||
@@ -3773,7 +3773,7 @@ FunctionCallExpr::GetType() const {
|
|||||||
const Type *
|
const Type *
|
||||||
FunctionCallExpr::GetLValueType() const {
|
FunctionCallExpr::GetLValueType() const {
|
||||||
const FunctionType *ftype = lGetFunctionType(func);
|
const FunctionType *ftype = lGetFunctionType(func);
|
||||||
if (ftype && (ftype->GetReturnType()->IsPointerType()
|
if (ftype && (ftype->GetReturnType()->IsPointerType()
|
||||||
|| ftype->GetReturnType()->IsReferenceType())) {
|
|| ftype->GetReturnType()->IsReferenceType())) {
|
||||||
return ftype->GetReturnType();
|
return ftype->GetReturnType();
|
||||||
}
|
}
|
||||||
@@ -4314,7 +4314,7 @@ IndexExpr::GetValue(FunctionEmitContext *ctx) const {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Symbol *baseSym = GetBaseSymbol();
|
Symbol *baseSym = GetBaseSymbol();
|
||||||
if (llvm::dyn_cast<FunctionCallExpr>(baseExpr) == NULL &&
|
if (llvm::dyn_cast<FunctionCallExpr>(baseExpr) == NULL &&
|
||||||
llvm::dyn_cast<BinaryExpr>(baseExpr) == NULL) {
|
llvm::dyn_cast<BinaryExpr>(baseExpr) == NULL) {
|
||||||
// Don't check if we're doing a function call or pointer arith
|
// Don't check if we're doing a function call or pointer arith
|
||||||
AssertPos(pos, baseSym != NULL);
|
AssertPos(pos, baseSym != NULL);
|
||||||
@@ -5168,7 +5168,7 @@ MemberExpr::create(Expr *e, const char *id, SourcePos p, SourcePos idpos,
|
|||||||
}
|
}
|
||||||
if (CastType<StructType>(exprType) != NULL) {
|
if (CastType<StructType>(exprType) != NULL) {
|
||||||
const StructType *st = CastType<StructType>(exprType);
|
const StructType *st = CastType<StructType>(exprType);
|
||||||
if (st->IsDefined()) {
|
if (st->IsDefined()) {
|
||||||
return new StructMemberExpr(e, id, p, idpos, derefLValue);
|
return new StructMemberExpr(e, id, p, idpos, derefLValue);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -7224,7 +7224,7 @@ TypeCastExpr::TypeCheck() {
|
|||||||
// Issues #721
|
// Issues #721
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AtomicType *fromAtomic = CastType<AtomicType>(fromType);
|
const AtomicType *fromAtomic = CastType<AtomicType>(fromType);
|
||||||
const AtomicType *toAtomic = CastType<AtomicType>(toType);
|
const AtomicType *toAtomic = CastType<AtomicType>(toType);
|
||||||
const EnumType *fromEnum = CastType<EnumType>(fromType);
|
const EnumType *fromEnum = CastType<EnumType>(fromType);
|
||||||
|
|||||||
40
expr.h
40
expr.h
@@ -166,12 +166,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
BinaryExpr(Op o, Expr *a, Expr *b, SourcePos p);
|
BinaryExpr(Op o, Expr *a, Expr *b, SourcePos p);
|
||||||
|
|
||||||
static inline bool classof(BinaryExpr const*) { return true; }
|
static inline bool classof(BinaryExpr const*) { return true; }
|
||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == BinaryExprID;
|
return N->getValueID() == BinaryExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
const Type *GetLValueType() const;
|
const Type *GetLValueType() const;
|
||||||
@@ -209,7 +209,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == AssignExprID;
|
return N->getValueID() == AssignExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
@@ -235,7 +235,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == SelectExprID;
|
return N->getValueID() == SelectExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
@@ -262,7 +262,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == ExprListID;
|
return N->getValueID() == ExprListID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
@@ -280,14 +280,14 @@ public:
|
|||||||
class FunctionCallExpr : public Expr {
|
class FunctionCallExpr : public Expr {
|
||||||
public:
|
public:
|
||||||
FunctionCallExpr(Expr *func, ExprList *args, SourcePos p,
|
FunctionCallExpr(Expr *func, ExprList *args, SourcePos p,
|
||||||
bool isLaunch = false,
|
bool isLaunch = false,
|
||||||
Expr *launchCountExpr[3] = NULL);
|
Expr *launchCountExpr[3] = NULL);
|
||||||
|
|
||||||
static inline bool classof(FunctionCallExpr const*) { return true; }
|
static inline bool classof(FunctionCallExpr const*) { return true; }
|
||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == FunctionCallExprID;
|
return N->getValueID() == FunctionCallExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
@@ -318,7 +318,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == IndexExprID;
|
return N->getValueID() == IndexExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
@@ -353,7 +353,7 @@ public:
|
|||||||
return ((N->getValueID() == StructMemberExprID) ||
|
return ((N->getValueID() == StructMemberExprID) ||
|
||||||
(N->getValueID() == VectorMemberExprID));
|
(N->getValueID() == VectorMemberExprID));
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
@@ -456,7 +456,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == ConstExprID;
|
return N->getValueID() == ConstExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
@@ -518,7 +518,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == TypeCastExprID;
|
return N->getValueID() == TypeCastExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
@@ -545,7 +545,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == ReferenceExprID;
|
return N->getValueID() == ReferenceExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
const Type *GetLValueType() const;
|
const Type *GetLValueType() const;
|
||||||
@@ -571,7 +571,7 @@ public:
|
|||||||
(N->getValueID() == PtrDerefExprID) ||
|
(N->getValueID() == PtrDerefExprID) ||
|
||||||
(N->getValueID() == RefDerefExprID));
|
(N->getValueID() == RefDerefExprID));
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetLValueType() const;
|
const Type *GetLValueType() const;
|
||||||
@@ -592,7 +592,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == PtrDerefExprID;
|
return N->getValueID() == PtrDerefExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
Expr *TypeCheck();
|
Expr *TypeCheck();
|
||||||
@@ -610,7 +610,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == RefDerefExprID;
|
return N->getValueID() == RefDerefExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
Expr *TypeCheck();
|
Expr *TypeCheck();
|
||||||
@@ -653,7 +653,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == SizeOfExprID;
|
return N->getValueID() == SizeOfExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
void Print() const;
|
void Print() const;
|
||||||
@@ -677,7 +677,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == SymbolExprID;
|
return N->getValueID() == SymbolExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetLValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
@@ -705,7 +705,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == FunctionSymbolExprID;
|
return N->getValueID() == FunctionSymbolExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
Symbol *GetBaseSymbol() const;
|
Symbol *GetBaseSymbol() const;
|
||||||
@@ -766,7 +766,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == SyncExprID;
|
return N->getValueID() == SyncExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
Expr *TypeCheck();
|
Expr *TypeCheck();
|
||||||
@@ -785,7 +785,7 @@ public:
|
|||||||
static inline bool classof(ASTNode const* N) {
|
static inline bool classof(ASTNode const* N) {
|
||||||
return N->getValueID() == NullPointerExprID;
|
return N->getValueID() == NullPointerExprID;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||||
const Type *GetType() const;
|
const Type *GetType() const;
|
||||||
Expr *TypeCheck();
|
Expr *TypeCheck();
|
||||||
|
|||||||
14
func.cpp
14
func.cpp
@@ -140,7 +140,7 @@ Function::Function(Symbol *s, Stmt *c) {
|
|||||||
|
|
||||||
if (type->isTask
|
if (type->isTask
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
&& (g->target->getISA() != Target::NVPTX)
|
&& (g->target->getISA() != Target::NVPTX)
|
||||||
#endif
|
#endif
|
||||||
){
|
){
|
||||||
threadIndexSym = m->symbolTable->LookupVariable("threadIndex");
|
threadIndexSym = m->symbolTable->LookupVariable("threadIndex");
|
||||||
@@ -260,8 +260,8 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
Assert(type != NULL);
|
Assert(type != NULL);
|
||||||
if (type->isTask == true
|
if (type->isTask == true
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
&& (g->target->getISA() != Target::NVPTX)
|
&& (g->target->getISA() != Target::NVPTX)
|
||||||
#endif
|
#endif
|
||||||
){
|
){
|
||||||
// For tasks, there should always be three parameters: the
|
// For tasks, there should always be three parameters: the
|
||||||
// pointer to the structure that holds all of the arguments, the
|
// pointer to the structure that holds all of the arguments, the
|
||||||
@@ -322,14 +322,14 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
|
|
||||||
taskCountSym->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount");
|
taskCountSym->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount");
|
||||||
ctx->StoreInst(taskCount, taskCountSym->storagePtr);
|
ctx->StoreInst(taskCount, taskCountSym->storagePtr);
|
||||||
|
|
||||||
taskIndexSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex0");
|
taskIndexSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex0");
|
||||||
ctx->StoreInst(taskIndex0, taskIndexSym0->storagePtr);
|
ctx->StoreInst(taskIndex0, taskIndexSym0->storagePtr);
|
||||||
taskIndexSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex1");
|
taskIndexSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex1");
|
||||||
ctx->StoreInst(taskIndex1, taskIndexSym1->storagePtr);
|
ctx->StoreInst(taskIndex1, taskIndexSym1->storagePtr);
|
||||||
taskIndexSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex2");
|
taskIndexSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex2");
|
||||||
ctx->StoreInst(taskIndex2, taskIndexSym2->storagePtr);
|
ctx->StoreInst(taskIndex2, taskIndexSym2->storagePtr);
|
||||||
|
|
||||||
taskCountSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount0");
|
taskCountSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount0");
|
||||||
ctx->StoreInst(taskCount0, taskCountSym0->storagePtr);
|
ctx->StoreInst(taskCount0, taskCountSym0->storagePtr);
|
||||||
taskCountSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount1");
|
taskCountSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount1");
|
||||||
@@ -570,7 +570,7 @@ Function::GenerateIR() {
|
|||||||
av.push_back(function);
|
av.push_back(function);
|
||||||
av.push_back(llvm::MDString::get(*g->ctx, "kernel"));
|
av.push_back(llvm::MDString::get(*g->ctx, "kernel"));
|
||||||
av.push_back(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1));
|
av.push_back(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1));
|
||||||
annotations->addOperand(llvm::MDNode::get(*g->ctx, av));
|
annotations->addOperand(llvm::MDNode::get(*g->ctx, av));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
@@ -611,7 +611,7 @@ Function::GenerateIR() {
|
|||||||
av.push_back(llvm::ValueAsMetadata::get(appFunction));
|
av.push_back(llvm::ValueAsMetadata::get(appFunction));
|
||||||
av.push_back(llvm::MDString::get(*g->ctx, "kernel"));
|
av.push_back(llvm::MDString::get(*g->ctx, "kernel"));
|
||||||
av.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1)));
|
av.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1)));
|
||||||
annotations->addOperand(llvm::MDNode::get(*g->ctx, llvm::ArrayRef<llvm::Metadata*>(av)));
|
annotations->addOperand(llvm::MDNode::get(*g->ctx, llvm::ArrayRef<llvm::Metadata*>(av)));
|
||||||
#else
|
#else
|
||||||
llvm::SmallVector<llvm::Value*, 3> av;
|
llvm::SmallVector<llvm::Value*, 3> av;
|
||||||
av.push_back(appFunction);
|
av.push_back(appFunction);
|
||||||
|
|||||||
32
stmt.cpp
32
stmt.cpp
@@ -150,11 +150,11 @@ lHasUnsizedArrays(const Type *type) {
|
|||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *value, const SourcePos ¤tPos, const bool variable = false)
|
static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *value, const SourcePos ¤tPos, const bool variable = false)
|
||||||
{
|
{
|
||||||
if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX)
|
if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX)
|
||||||
return value;
|
return value;
|
||||||
llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(value->getType());
|
llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(value->getType());
|
||||||
const int addressSpace = pt->getAddressSpace();
|
const int addressSpace = pt->getAddressSpace();
|
||||||
if (addressSpace != 3 && addressSpace != 4)
|
if (addressSpace != 3 && addressSpace != 4)
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
llvm::Type *elTy = pt->getElementType();
|
llvm::Type *elTy = pt->getElementType();
|
||||||
@@ -276,17 +276,17 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
if (g->target->getISA() == Target::NVPTX && !sym->type->IsConstType())
|
if (g->target->getISA() == Target::NVPTX && !sym->type->IsConstType())
|
||||||
{
|
{
|
||||||
Error(sym->pos,
|
Error(sym->pos,
|
||||||
"Non-constant static variable ""\"%s\" is not supported with ""\"nvptx\" target.",
|
"Non-constant static variable ""\"%s\" is not supported with ""\"nvptx\" target.",
|
||||||
sym->name.c_str());
|
sym->name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g->target->getISA() == Target::NVPTX && sym->type->IsVaryingType())
|
if (g->target->getISA() == Target::NVPTX && sym->type->IsVaryingType())
|
||||||
PerformanceWarning(sym->pos,
|
PerformanceWarning(sym->pos,
|
||||||
"\"const static varying\" variable ""\"%s\" is stored in __global address space with ""\"nvptx\" target.",
|
"\"const static varying\" variable ""\"%s\" is stored in __global address space with ""\"nvptx\" target.",
|
||||||
sym->name.c_str());
|
sym->name.c_str());
|
||||||
if (g->target->getISA() == Target::NVPTX && sym->type->IsUniformType())
|
if (g->target->getISA() == Target::NVPTX && sym->type->IsUniformType())
|
||||||
PerformanceWarning(sym->pos,
|
PerformanceWarning(sym->pos,
|
||||||
"\"const static uniform\" variable ""\"%s\" is stored in __constant address space with ""\"nvptx\" target.",
|
"\"const static uniform\" variable ""\"%s\" is stored in __constant address space with ""\"nvptx\" target.",
|
||||||
sym->name.c_str());
|
sym->name.c_str());
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
@@ -351,11 +351,11 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
else if ((sym->type->IsUniformType() || sym->type->IsSOAType()) &&
|
else if ((sym->type->IsUniformType() || sym->type->IsSOAType()) &&
|
||||||
/* NVPTX:
|
/* NVPTX:
|
||||||
* only non-constant uniform data types are stored in shared memory
|
* only non-constant uniform data types are stored in shared memory
|
||||||
* constant uniform are automatically promoted to varying
|
* constant uniform are automatically promoted to varying
|
||||||
*/
|
*/
|
||||||
!sym->type->IsConstType() &&
|
!sym->type->IsConstType() &&
|
||||||
#if 1
|
#if 1
|
||||||
sym->type->IsArrayType() &&
|
sym->type->IsArrayType() &&
|
||||||
#endif
|
#endif
|
||||||
g->target->getISA() == Target::NVPTX)
|
g->target->getISA() == Target::NVPTX)
|
||||||
@@ -375,7 +375,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
* or 128 threads.
|
* or 128 threads.
|
||||||
* ***note-to-me***:please define these value (128threads/4warps)
|
* ***note-to-me***:please define these value (128threads/4warps)
|
||||||
* in nvptx-target definition
|
* in nvptx-target definition
|
||||||
* instead of compile-time constants
|
* instead of compile-time constants
|
||||||
*/
|
*/
|
||||||
nel *= at->GetElementCount();
|
nel *= at->GetElementCount();
|
||||||
if (sym->type->IsSOAType())
|
if (sym->type->IsSOAType())
|
||||||
@@ -392,9 +392,9 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
sym->storagePtr =
|
sym->storagePtr =
|
||||||
new llvm::GlobalVariable(*m->module, llvmTypeUn,
|
new llvm::GlobalVariable(*m->module, llvmTypeUn,
|
||||||
sym->type->IsConstType(),
|
sym->type->IsConstType(),
|
||||||
llvm::GlobalValue::InternalLinkage,
|
llvm::GlobalValue::InternalLinkage,
|
||||||
cinit,
|
cinit,
|
||||||
llvm::Twine("local_") +
|
llvm::Twine("local_") +
|
||||||
llvm::Twine(sym->pos.first_line) +
|
llvm::Twine(sym->pos.first_line) +
|
||||||
llvm::Twine("_") + sym->name.c_str(),
|
llvm::Twine("_") + sym->name.c_str(),
|
||||||
NULL,
|
NULL,
|
||||||
@@ -595,7 +595,7 @@ IfStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
#if 0
|
#if 0
|
||||||
if (!isUniform && g->target->getISA() == Target::NVPTX)
|
if (!isUniform && g->target->getISA() == Target::NVPTX)
|
||||||
{
|
{
|
||||||
/* With "nvptx" target, SIMT hardware takes care of non-uniform
|
/* With "nvptx" target, SIMT hardware takes care of non-uniform
|
||||||
* control flow. We trick ISPC to generate uniform control flow.
|
* control flow. We trick ISPC to generate uniform control flow.
|
||||||
*/
|
*/
|
||||||
testValue = ctx->ExtractInst(testValue, 0);
|
testValue = ctx->ExtractInst(testValue, 0);
|
||||||
@@ -1500,9 +1500,9 @@ lUpdateVaryingCounter(int dim, int nDims, FunctionEmitContext *ctx,
|
|||||||
// (0,1,2,3,0,1,2,3), and for the outer dimension we want
|
// (0,1,2,3,0,1,2,3), and for the outer dimension we want
|
||||||
// (0,0,0,0,1,1,1,1).
|
// (0,0,0,0,1,1,1,1).
|
||||||
int32_t delta[ISPC_MAX_NVEC];
|
int32_t delta[ISPC_MAX_NVEC];
|
||||||
const int vecWidth = 32;
|
const int vecWidth = 32;
|
||||||
std::vector<llvm::Constant*> constDeltaList;
|
std::vector<llvm::Constant*> constDeltaList;
|
||||||
for (int i = 0; i < vecWidth; ++i)
|
for (int i = 0; i < vecWidth; ++i)
|
||||||
{
|
{
|
||||||
int d = i;
|
int d = i;
|
||||||
// First, account for the effect of any dimensions at deeper
|
// First, account for the effect of any dimensions at deeper
|
||||||
@@ -1699,7 +1699,7 @@ ForeachStmt::EmitCode(FunctionEmitContext *ctx) const {
|
|||||||
|
|
||||||
std::vector<int> span(nDims, 0);
|
std::vector<int> span(nDims, 0);
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
const int vectorWidth =
|
const int vectorWidth =
|
||||||
g->target->getISA() == Target::NVPTX ? 32 : g->target->getVectorWidth();
|
g->target->getISA() == Target::NVPTX ? 32 : g->target->getVectorWidth();
|
||||||
lGetSpans(nDims-1, nDims, vectorWidth, isTiled, &span[0]);
|
lGetSpans(nDims-1, nDims, vectorWidth, isTiled, &span[0]);
|
||||||
#else /* ISPC_NVPTX_ENABLED */
|
#else /* ISPC_NVPTX_ENABLED */
|
||||||
@@ -3343,7 +3343,7 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (Type::Equal(baseType, AtomicType::UniformBool)) {
|
if (Type::Equal(baseType, AtomicType::UniformBool)) {
|
||||||
// Blast bools to ints, but do it here to preserve encoding for
|
// Blast bools to ints, but do it here to preserve encoding for
|
||||||
// printing 'true' or 'false'
|
// printing 'true' or 'false'
|
||||||
expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 :
|
expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 :
|
||||||
AtomicType::VaryingInt32,
|
AtomicType::VaryingInt32,
|
||||||
|
|||||||
2
sym.h
2
sym.h
@@ -219,7 +219,7 @@ public:
|
|||||||
@return Pointer to the Type, if found; otherwise NULL is returned.
|
@return Pointer to the Type, if found; otherwise NULL is returned.
|
||||||
*/
|
*/
|
||||||
const Type *LookupType(const char *name) const;
|
const Type *LookupType(const char *name) const;
|
||||||
|
|
||||||
/** Look for a type given a pointer.
|
/** Look for a type given a pointer.
|
||||||
|
|
||||||
@return True if found, False otherwise.
|
@return True if found, False otherwise.
|
||||||
|
|||||||
Reference in New Issue
Block a user