Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Type representing a function (return type + argument types) More...
#include <type.h>
Public Member Functions | |
FunctionType (const Type *returnType, const llvm::SmallVector< const Type *, 8 > &argTypes, SourcePos pos) | |
FunctionType (const Type *returnType, const llvm::SmallVector< const Type *, 8 > &argTypes, const llvm::SmallVector< std::string, 8 > &argNames, const llvm::SmallVector< Expr *, 8 > &argDefaults, const llvm::SmallVector< SourcePos, 8 > &argPos, bool isTask, bool isExported, bool isExternC, bool isUnmasked) | |
Variability | GetVariability () const |
bool | IsBoolType () const |
bool | IsFloatType () const |
bool | IsIntType () const |
bool | IsUnsignedType () const |
bool | IsConstType () const |
const Type * | GetBaseType () const |
const Type * | GetAsVaryingType () const |
const Type * | GetAsUniformType () const |
const Type * | GetAsUnboundVariabilityType () const |
const Type * | GetAsSOAType (int width) const |
const FunctionType * | ResolveUnboundVariability (Variability v) const |
const Type * | GetAsConstType () const |
const Type * | GetAsNonConstType () const |
std::string | GetString () const |
std::string | Mangle () const |
std::string | GetCDeclaration (const std::string &fname) const |
std::string | GetCDeclarationForDispatch (const std::string &fname) const |
llvm::Type * | LLVMType (llvm::LLVMContext *ctx) const |
llvm::DIType * | GetDIType (llvm::DIScope *scope) const |
const Type * | GetReturnType () const |
const std::string | GetReturnTypeString () const |
llvm::FunctionType * | LLVMFunctionType (llvm::LLVMContext *ctx, bool disableMask=false) const |
int | GetNumParameters () const |
const Type * | GetParameterType (int i) const |
Expr * | GetParameterDefault (int i) const |
const SourcePos & | GetParameterSourcePos (int i) const |
const std::string & | GetParameterName (int i) const |
Public Member Functions inherited from Type | |
bool | IsPointerType () const |
bool | IsArrayType () const |
bool | IsReferenceType () const |
bool | IsVoidType () const |
bool | IsNumericType () const |
bool | IsUniformType () const |
bool | IsVaryingType () const |
bool | IsSOAType () const |
int | GetSOAWidth () const |
bool | HasUnboundVariability () const |
virtual const Type * | GetAsUnsignedType () const |
virtual const Type * | GetReferenceTarget () const |
virtual llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) const |
Public Attributes | |
const bool | isTask |
const bool | isExported |
const bool | isExternC |
const bool | isUnmasked |
bool | isSafe |
int | costOverride |
Public Attributes inherited from Type | |
const TypeId | typeId |
Private Attributes | |
const Type *const | returnType |
const llvm::SmallVector< const Type *, 8 > | paramTypes |
const llvm::SmallVector< std::string, 8 > | paramNames |
llvm::SmallVector< Expr *, 8 > | paramDefaults |
const llvm::SmallVector< SourcePos, 8 > | paramPositions |
Additional Inherited Members | |
Static Public Member Functions inherited from Type | |
static bool | Equal (const Type *a, const Type *b) |
static bool | EqualIgnoringConst (const Type *a, const Type *b) |
static const Type * | MoreGeneralType (const Type *type0, const Type *type1, SourcePos pos, const char *reason, bool forceVarying=false, int vecSize=0) |
static bool | IsBasicType (const Type *type) |
Protected Member Functions inherited from Type | |
Type (TypeId id) | |
Type representing a function (return type + argument types)
FunctionType encapsulates the information related to a function's type, including the return type and the types of the arguments.
FunctionType::FunctionType | ( | const Type * | returnType, |
const llvm::SmallVector< const Type *, 8 > & | argTypes, | ||
SourcePos | pos | ||
) |
Definition at line 2247 of file type.cpp.
References Assert, costOverride, isSafe, and returnType.
Referenced by ResolveUnboundVariability().
FunctionType::FunctionType | ( | const Type * | returnType, |
const llvm::SmallVector< const Type *, 8 > & | argTypes, | ||
const llvm::SmallVector< std::string, 8 > & | argNames, | ||
const llvm::SmallVector< Expr *, 8 > & | argDefaults, | ||
const llvm::SmallVector< SourcePos, 8 > & | argPos, | ||
bool | isTask, | ||
bool | isExported, | ||
bool | isExternC, | ||
bool | isUnmasked | ||
) |
Definition at line 2257 of file type.cpp.
References Assert, costOverride, isSafe, paramDefaults, paramNames, paramPositions, paramTypes, and returnType.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 2364 of file type.cpp.
References PointerType::GetBaseType(), Type::GetCDeclaration(), Type::GetString(), paramNames, paramTypes, and returnType.
Referenced by lPrintFunctionDeclarations(), and Module::writeHostStub().
std::string FunctionType::GetCDeclarationForDispatch | ( | const std::string & | fname | ) | const |
Definition at line 2392 of file type.cpp.
References PointerType::GetBaseType(), Type::GetCDeclaration(), PointerType::GetCDeclaration(), Type::GetString(), PointerType::GetString(), Type::IsVaryingType(), paramNames, paramTypes, returnType, and PointerType::Void.
Referenced by lPrintFunctionDeclarations().
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 2435 of file type.cpp.
References Module::diBuilder, Type::GetDIType(), GetNumParameters(), GetParameterType(), m, and returnType.
Referenced by FunctionEmitContext::FunctionEmitContext().
|
inline |
Definition at line 874 of file type.h.
Referenced by Module::AddFunctionDeclaration(), emitOffloadParamStruct(), Function::Function(), FunctionSymbolExpr::getCandidateFunctions(), GetDIType(), FunctionCallExpr::GetValue(), lCalleeArgCount(), lCheckForStructParameters(), lCheckTypeEquality(), lGetExportedParamTypes(), lGetVaryingDispatchType(), PossiblyResolveFunctionOverloads(), FunctionCallExpr::TypeCheck(), Module::writeDevStub(), and Module::writeHostStub().
Expr * FunctionType::GetParameterDefault | ( | int | i | ) | const |
Definition at line 2546 of file type.cpp.
References Assert, and paramDefaults.
Referenced by Module::AddFunctionDeclaration(), FunctionSymbolExpr::getCandidateFunctions(), FunctionCallExpr::GetValue(), and FunctionCallExpr::TypeCheck().
const std::string & FunctionType::GetParameterName | ( | int | i | ) | const |
Definition at line 2556 of file type.cpp.
References Assert, and paramNames.
Referenced by Module::AddFunctionDeclaration(), emitOffloadParamStruct(), Function::Function(), Module::writeDevStub(), and Module::writeHostStub().
const SourcePos & FunctionType::GetParameterSourcePos | ( | int | i | ) | const |
Definition at line 2551 of file type.cpp.
References Assert, and paramPositions.
Referenced by Module::AddFunctionDeclaration().
const Type * FunctionType::GetParameterType | ( | int | i | ) | const |
Definition at line 2541 of file type.cpp.
References Assert, and paramTypes.
Referenced by Module::AddFunctionDeclaration(), FunctionSymbolExpr::computeOverloadCost(), emitOffloadParamStruct(), Function::Function(), GetDIType(), FunctionCallExpr::GetValue(), lCheckForStructParameters(), lCheckTypeEquality(), lGetExportedParamTypes(), lGetVaryingDispatchType(), PossiblyResolveFunctionOverloads(), FunctionCallExpr::TypeCheck(), Module::writeDevStub(), and Module::writeHostStub().
|
inline |
Definition at line 864 of file type.h.
Referenced by Module::AddFunctionDeclaration(), FunctionEmitContext::CallInst(), Function::emitCode(), FunctionCallExpr::GetLValueType(), Function::GetReturnType(), FunctionCallExpr::GetType(), FunctionCallExpr::GetValue(), lCheckTypeEquality(), lGetExportedParamTypes(), FunctionCallExpr::TypeCheck(), Module::writeDevStub(), and Module::writeHostStub().
const std::string FunctionType::GetReturnTypeString | ( | ) | const |
Definition at line 2452 of file type.cpp.
References costOverride, Type::GetString(), isExported, isExternC, isSafe, isTask, isUnmasked, and returnType.
Referenced by Module::AddFunctionDeclaration(), and GetString().
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 2334 of file type.cpp.
References GetReturnTypeString(), and paramTypes.
Referenced by Function::emitCode(), lCreateSymbol(), and lGetOverloadCandidateMessage().
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 2269 of file type.cpp.
References Variability::Uniform.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
llvm::FunctionType * FunctionType::LLVMFunctionType | ( | llvm::LLVMContext * | ctx, |
bool | disableMask = false |
||
) | const |
This method returns the LLVM FunctionType that corresponds to this function type. The disableMask
parameter indicates whether the llvm::FunctionType should have the trailing mask parameter, if present, removed from the return function signature.
Definition at line 2476 of file type.cpp.
References Assert, Globals::ctx, Module::errorCount, g, LLVMTypes::Int32Type, isTask, isUnmasked, Type::IsVoidType(), Type::LLVMType(), m, LLVMTypes::MaskType, paramTypes, and returnType.
Referenced by Module::AddFunctionDeclaration(), FunctionEmitContext::CallInst(), Function::GenerateIR(), and PointerType::LLVMType().
|
virtual |
|
virtual |
Returns a string that represents the mangled type (for use in mangling function symbol names for function overloading). The various Types implementations of this method should collectively ensure that all of them use mangling schemes that are guaranteed not to clash.
Implements Type.
Definition at line 2350 of file type.cpp.
References Assert, Module::errorCount, isUnmasked, m, and paramTypes.
Referenced by Module::AddFunctionDeclaration().
|
virtual |
Implements Type.
Definition at line 2306 of file type.cpp.
References Assert, costOverride, Module::errorCount, FunctionType(), isExported, isExternC, isSafe, isTask, isUnmasked, m, paramDefaults, paramNames, paramPositions, paramTypes, Type::ResolveUnboundVariability(), and returnType.
int FunctionType::costOverride |
If non-negative, this provides a user-supplied override to the cost function estimate for the function.
Definition at line 903 of file type.h.
Referenced by FunctionCallExpr::EstimateCost(), FunctionType(), GetReturnTypeString(), and ResolveUnboundVariability().
const bool FunctionType::isExported |
This value is true if the function had a 'export' qualifier in the source program.
Definition at line 886 of file type.h.
Referenced by Module::AddFunctionDeclaration(), Function::emitCode(), Function::GenerateIR(), GetReturnTypeString(), lCheckTypeEquality(), lIsExported(), and ResolveUnboundVariability().
const bool FunctionType::isExternC |
This value is true if the function was declared as an 'extern "C"' function in the source program.
Definition at line 890 of file type.h.
Referenced by Module::AddFunctionDeclaration(), Function::GenerateIR(), GetReturnTypeString(), lCheckTypeEquality(), lIsExternC(), and ResolveUnboundVariability().
bool FunctionType::isSafe |
Indicates whether this function has been declared to be safe to run with an all-off mask.
Definition at line 899 of file type.h.
Referenced by FunctionType(), GetReturnTypeString(), lCheckAllOffSafety(), and ResolveUnboundVariability().
const bool FunctionType::isTask |
This value is true if the function had a 'task' qualifier in the source program.
Definition at line 882 of file type.h.
Referenced by Module::AddFunctionDeclaration(), Function::emitCode(), Function::Function(), Function::GenerateIR(), GetReturnTypeString(), FunctionCallExpr::GetValue(), lCheckTypeEquality(), LLVMFunctionType(), ResolveUnboundVariability(), and FunctionCallExpr::TypeCheck().
const bool FunctionType::isUnmasked |
Indicates whether the function doesn't take an implicit mask parameter (and thus should start execution with an "all on" mask).
Definition at line 895 of file type.h.
Referenced by Function::emitCode(), GetReturnTypeString(), lCheckTypeEquality(), LLVMFunctionType(), Mangle(), and ResolveUnboundVariability().
|
mutableprivate |
Default values of the function's arguments. For arguments without default values provided, NULL is stored.
Definition at line 914 of file type.h.
Referenced by FunctionType(), GetParameterDefault(), and ResolveUnboundVariability().
|
private |
Definition at line 911 of file type.h.
Referenced by FunctionType(), GetCDeclaration(), GetCDeclarationForDispatch(), GetParameterName(), and ResolveUnboundVariability().
|
private |
The names provided (if any) with the function arguments in the function's signature. These should only be used for error messages and the like and so not affect testing function types for equality, etc.
Definition at line 919 of file type.h.
Referenced by FunctionType(), GetParameterSourcePos(), and ResolveUnboundVariability().
|
private |
Definition at line 910 of file type.h.
Referenced by FunctionType(), GetCDeclaration(), GetCDeclarationForDispatch(), GetParameterType(), GetString(), LLVMFunctionType(), Mangle(), and ResolveUnboundVariability().
|
private |
Definition at line 906 of file type.h.
Referenced by FunctionType(), GetCDeclaration(), GetCDeclarationForDispatch(), GetDIType(), GetReturnTypeString(), LLVMFunctionType(), and ResolveUnboundVariability().