Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Representation of a program symbol. More...
#include <sym.h>
Public Member Functions | |
Symbol (const std::string &name, SourcePos pos, const Type *t=NULL, StorageClass sc=SC_NONE) | |
Public Attributes | |
SourcePos | pos |
std::string | name |
llvm::Value * | storagePtr |
llvm::Function * | function |
llvm::Function * | exportedFunction |
const Type * | type |
ConstExpr * | constValue |
StorageClass | storageClass |
int | varyingCFDepth |
const Function * | parentFunction |
Representation of a program symbol.
The Symbol class represents a symbol in an ispc program. Symbols can include variables, functions, and named types. Note that all of the members are publically accessible; other code throughout the system accesses and modifies the members directly.
Symbol::Symbol | ( | const std::string & | name, |
SourcePos | pos, | ||
const Type * | t = NULL , |
||
StorageClass | sc = SC_NONE |
||
) |
The Symbol constructor takes the name of the symbol, its position in a source file, and its type (if known).
Definition at line 46 of file sym.cpp.
References constValue, exportedFunction, parentFunction, storageClass, storagePtr, type, and varyingCFDepth.
ConstExpr* Symbol::constValue |
For symbols with const-qualified types, this may store the symbol's compile-time constant value. This value may validly be NULL for a const-qualified type, however; for example, the ConstExpr class can't currently represent struct types. For cases like these, ConstExpr is NULL, though for all const symbols, the value pointed to by the storagePtr member will be its constant value. (This messiness is due to needing an ispc ConstExpr for the early constant folding optimizations).
Definition at line 85 of file sym.h.
Referenced by Module::AddGlobalVariable(), lDefineConstantInt(), lDefineProgramIndex(), lEmitEnumDecls(), DeclStmt::Optimize(), SymbolExpr::Optimize(), and Symbol().
llvm::Function* Symbol::exportedFunction |
For symbols that represent functions with 'export' qualifiers, this points to the LLVM Function for the application-callable version of the function.
Definition at line 77 of file sym.h.
Referenced by Function::GenerateIR(), lSymbolIsExported(), and Symbol().
llvm::Function* Symbol::function |
For symbols that represent functions, this stores the LLVM Function value for the symbol once it has been created.
Definition at line 74 of file sym.h.
Referenced by Module::AddFunctionDeclaration(), Function::GenerateIR(), FunctionSymbolExpr::GetConstant(), FunctionSymbolExpr::GetValue(), lCreateISPCSymbol(), and lDefineConstantIntFunc().
std::string Symbol::name |
Symbol's name
Definition at line 69 of file sym.h.
Referenced by SymbolTable::AddFunction(), Module::AddGlobalVariable(), SymbolTable::AddType(), SymbolTable::AddVariable(), SymbolTable::ClosestVariableOrFunctionMatch(), Function::emitCode(), DeclStmt::EmitCode(), ForeachActiveStmt::EmitCode(), ForeachUniqueStmt::EmitCode(), FunctionEmitContext::EmitFunctionParameterDebugInfo(), FunctionEmitContext::EmitVariableDebugInfo(), Function::Function(), FunctionEmitContext::FunctionEmitContext(), Function::GenerateIR(), SymbolExpr::GetValue(), lCopyInTaskParameter(), lDefineProgramIndex(), lEmitEnumDecls(), SymbolTable::Print(), ForeachActiveStmt::Print(), ForeachUniqueStmt::Print(), SymbolExpr::Print(), FunctionSymbolExpr::Print(), Module::writeDevStub(), and Module::writeHostStub().
const Function* Symbol::parentFunction |
For symbols that are parameters to functions or are variables declared inside functions, this gives the function they're in.
Definition at line 102 of file sym.h.
Referenced by DeclStmt::EmitCode(), Function::Function(), lMaskForSymbol(), and Symbol().
SourcePos Symbol::pos |
Source file position where the symbol was defined
Definition at line 68 of file sym.h.
Referenced by Module::AddFunctionDeclaration(), Module::AddFunctionDefinition(), Module::AddGlobalVariable(), SymbolTable::AddVariable(), Function::emitCode(), DeclStmt::EmitCode(), FunctionEmitContext::EmitFunctionParameterDebugInfo(), emitOffloadParamStruct(), FunctionEmitContext::EmitVariableDebugInfo(), FunctionEmitContext::FunctionEmitContext(), Function::GenerateIR(), lExtractOrCheckGlobals(), Module::writeDevStub(), and Module::writeHostStub().
StorageClass Symbol::storageClass |
Records the storage class (if any) provided with the symbol's declaration.
Definition at line 94 of file sym.h.
Referenced by Module::AddGlobalVariable(), DeclStmt::EmitCode(), FunctionEmitContext::FunctionEmitContext(), lMaskForSymbol(), lStoreAssignResult(), and Symbol().
llvm::Value* Symbol::storagePtr |
For symbols with storage associated with them (i.e. variables but not functions), this member stores a pointer to its location in memory.)
Definition at line 70 of file sym.h.
Referenced by Module::AddGlobalVariable(), Function::emitCode(), DeclStmt::EmitCode(), ForeachActiveStmt::EmitCode(), ForeachUniqueStmt::EmitCode(), FunctionEmitContext::EmitFunctionParameterDebugInfo(), FunctionEmitContext::EmitVariableDebugInfo(), TypeCastExpr::GetConstant(), AddressOfExpr::GetConstant(), SymbolExpr::GetLValue(), SymbolExpr::GetValue(), lCopyInTaskParameter(), lDefineConstantInt(), lDefineProgramIndex(), and Symbol().
const Type* Symbol::type |
The type of the symbol; if not set by the constructor, this is set after the declaration around the symbol has been parsed.
Definition at line 82 of file sym.h.
Referenced by SymbolTable::AddFunction(), Module::AddFunctionDeclaration(), Module::AddFunctionDefinition(), Module::AddGlobalVariable(), SymbolTable::AddType(), Function::emitCode(), DeclStmt::EmitCode(), ForeachActiveStmt::EmitCode(), ForeachUniqueStmt::EmitCode(), FunctionEmitContext::EmitFunctionParameterDebugInfo(), FunctionEmitContext::EmitVariableDebugInfo(), Function::Function(), Function::GenerateIR(), FunctionSymbolExpr::GetConstant(), SymbolExpr::GetLValueType(), Function::GetReturnType(), Function::GetType(), SymbolExpr::GetType(), FunctionSymbolExpr::GetType(), SymbolExpr::GetValue(), lCopyInTaskParameter(), lDefineConstantInt(), lDefineProgramIndex(), lIsExported(), lIsExternC(), lMaskForSymbol(), lStoreAssignResult(), DeclStmt::Optimize(), SymbolTable::Print(), ForeachActiveStmt::Print(), ForeachUniqueStmt::Print(), Symbol(), Module::writeDevStub(), and Module::writeHostStub().
int Symbol::varyingCFDepth |
This member records the number of levels of nested 'varying' control flow within which the symbol was declared. Having this value available makes it possible to avoid performing masked stores when modifying the symbol's value when the store is done at the same 'varying' control flow depth as the one where the symbol was originally declared.
Definition at line 96 of file sym.h.
Referenced by DeclStmt::EmitCode(), lStoreAssignResult(), and Symbol().