__declspec support for function declarations.

safe: indicates that the function can safely be called with an "all off"
execution mask.

costN: (N an integer) overrides the cost estimate for the function with
the given value.
This commit is contained in:
Matt Pharr
2012-03-21 15:37:04 -07:00
parent ddf350839a
commit ccd550dc52
5 changed files with 88 additions and 23 deletions

View File

@@ -3518,18 +3518,23 @@ int
FunctionCallExpr::EstimateCost() const {
if (isLaunch)
return COST_TASK_LAUNCH;
else if (dynamic_cast<FunctionSymbolExpr *>(func) == NULL) {
// it's going through a function pointer
const Type *fpType = func->GetType();
if (fpType != NULL) {
Assert(dynamic_cast<const PointerType *>(fpType) != NULL);
if (fpType->IsUniformType())
return COST_FUNPTR_UNIFORM;
else
return COST_FUNPTR_VARYING;
}
}
return COST_FUNCALL;
const Type *type = func->GetType();
if (type == NULL)
return 0;
const PointerType *pt = dynamic_cast<const PointerType *>(type);
if (pt != NULL)
type = type->GetBaseType();
const FunctionType *ftype = dynamic_cast<const FunctionType *>(type);
if (ftype->costOverride > -1)
return ftype->costOverride;
if (pt != NULL)
return pt->IsUniformType() ? COST_FUNPTR_UNIFORM : COST_FUNPTR_VARYING;
else
return COST_FUNCALL;
}