Intel SPMD Program Compiler  1.12.0
Public Member Functions | Public Attributes | List of all members
Symbol Class Reference

Representation of a program symbol. More...

#include <sym.h>

Collaboration diagram for Symbol:
Collaboration graph
[legend]

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 Typetype
 
ConstExprconstValue
 
StorageClass storageClass
 
int varyingCFDepth
 
const FunctionparentFunction
 

Detailed Description

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.

Todo:
Should we break function symbols into a separate FunctionSymbol class and then not have these members that are not applicable for function symbols (and vice versa, for non-function symbols)?

Definition at line 63 of file sym.h.

Constructor & Destructor Documentation

◆ Symbol()

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.

Member Data Documentation

◆ constValue

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 86 of file sym.h.

Referenced by Module::AddGlobalVariable(), lDefineConstantInt(), lDefineProgramIndex(), lEmitEnumDecls(), DeclStmt::Optimize(), SymbolExpr::Optimize(), and Symbol().

◆ exportedFunction

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 78 of file sym.h.

Referenced by Function::GenerateIR(), lSymbolIsExported(), and Symbol().

◆ function

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 75 of file sym.h.

Referenced by Module::AddFunctionDeclaration(), Function::GenerateIR(), FunctionSymbolExpr::GetConstant(), FunctionSymbolExpr::GetValue(), lCreateISPCSymbol(), and lDefineConstantIntFunc().

◆ name

std::string Symbol::name

◆ parentFunction

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 103 of file sym.h.

Referenced by DeclStmt::EmitCode(), Function::Function(), lMaskForSymbol(), and Symbol().

◆ pos

SourcePos Symbol::pos

◆ storageClass

StorageClass Symbol::storageClass

Records the storage class (if any) provided with the symbol's declaration.

Definition at line 95 of file sym.h.

Referenced by Module::AddGlobalVariable(), DeclStmt::EmitCode(), FunctionEmitContext::FunctionEmitContext(), lMaskForSymbol(), lStoreAssignResult(), and Symbol().

◆ storagePtr

llvm::Value* Symbol::storagePtr

◆ type

const Type* Symbol::type

◆ varyingCFDepth

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 97 of file sym.h.

Referenced by DeclStmt::EmitCode(), lStoreAssignResult(), and Symbol().


The documentation for this class was generated from the following files: