Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
File with definitions classes related to statements in the language. More...
#include "stmt.h"
#include "ctx.h"
#include "expr.h"
#include "func.h"
#include "llvmutil.h"
#include "module.h"
#include "sym.h"
#include "type.h"
#include "util.h"
#include <map>
#include <stdio.h>
#include <llvm/IR/CallingConv.h>
#include <llvm/IR/DerivedTypes.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Metadata.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Type.h>
#include <llvm/Support/raw_ostream.h>
Go to the source code of this file.
Classes | |
struct | VaryingBCCheckInfo |
struct | SwitchVisitInfo |
Functions | |
static bool | lHasUnsizedArrays (const Type *type) |
static bool | checkInit (const Type *type, Expr **init) |
static void | lEmitIfStatements (FunctionEmitContext *ctx, Stmt *stmts, const char *trueOrFalse) |
static bool | lIsVaryingFor (ASTNode *node) |
static bool | lVaryingBCPreFunc (ASTNode *node, void *d) |
static ASTNode * | lVaryingBCPostFunc (ASTNode *node, void *d) |
static bool | lHasVaryingBreakOrContinue (Stmt *stmt) |
static llvm::Value * | lUpdateVaryingCounter (int dim, int nDims, FunctionEmitContext *ctx, llvm::Value *uniformCounterPtr, llvm::Value *varyingCounterPtr, const std::vector< int > &spans) |
static int | lLog2 (int i) |
static void | lGetSpans (int dimsLeft, int nDims, int itemsLeft, bool isTiled, int *a) |
static bool | lCheckMask (Stmt *stmts) |
static bool | lSwitchASTPreVisit (ASTNode *node, void *d) |
static char | lEncodeType (const Type *t) |
static llvm::Value * | lProcessPrintArg (Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) |
File with definitions classes related to statements in the language.
Definition in file stmt.cpp.
Definition at line 266 of file stmt.cpp.
References Error(), StructType::GetElementCount(), StructType::GetElementType(), and TypeConvertExpr().
Referenced by DeclStmt::TypeCheck().
|
static |
Given the statements following a 'case' or 'default' label, this function determines whether the mask should be checked to see if it is "all off" immediately after the label, before executing the code for the statements.
Definition at line 2135 of file stmt.cpp.
References ForeachUniqueStmt::EstimateCost(), PREDICATE_SAFE_IF_STATEMENT_COST, and SafeToRunWithMaskAllOff().
Referenced by CaseStmt::EmitCode(), and DefaultStmt::EmitCode().
|
static |
Definition at line 337 of file stmt.cpp.
References FunctionEmitContext::AddInstrumentationPoint(), Stmt::EmitCode(), FunctionEmitContext::EndScope(), and FunctionEmitContext::StartScope().
Referenced by IfStmt::EmitCode(), IfStmt::emitMaskAllOn(), IfStmt::emitMaskedTrueAndFalse(), and IfStmt::emitMaskMixed().
|
static |
Definition at line 2608 of file stmt.cpp.
References Type::Equal(), Type::IsUniformType(), AtomicType::UniformBool, AtomicType::UniformDouble, AtomicType::UniformFloat, AtomicType::UniformInt32, AtomicType::UniformInt64, AtomicType::UniformUInt32, AtomicType::UniformUInt64, AtomicType::VaryingBool, AtomicType::VaryingDouble, AtomicType::VaryingFloat, AtomicType::VaryingInt32, AtomicType::VaryingInt64, AtomicType::VaryingUInt32, and AtomicType::VaryingUInt64.
Referenced by lProcessPrintArg().
|
static |
Definition at line 1207 of file stmt.cpp.
References lLog2().
Referenced by ForeachStmt::EmitCode().
|
static |
Definition at line 100 of file stmt.cpp.
References ArrayType::GetElementCount(), and ArrayType::GetElementType().
Referenced by DeclStmt::EmitCode().
|
static |
Given a statment, walk through it to see if there is a 'break' or 'continue' statement inside if its children, under varying control flow. We need to detect this case for loops since what might otherwise look like a 'uniform' loop needs to have code emitted to do all of the lane management stuff if this is the case.
Definition at line 749 of file stmt.cpp.
References VaryingBCCheckInfo::foundVaryingBreakOrContinue, lVaryingBCPostFunc(), lVaryingBCPreFunc(), and WalkAST().
Referenced by ForStmt::EmitCode(), SwitchStmt::EmitCode(), DoStmt::EstimateCost(), ForStmt::EstimateCost(), DoStmt::TypeCheck(), and ForStmt::TypeCheck().
|
static |
Returns true if the given node is an 'if' statement where the test condition has varying type.
Definition at line 697 of file stmt.cpp.
References Expr::GetType(), Type::IsVaryingType(), and IfStmt::test.
Referenced by lVaryingBCPostFunc(), and lVaryingBCPreFunc().
|
static |
Returns the integer log2 of the given integer.
Definition at line 1189 of file stmt.cpp.
Referenced by lGetSpans().
|
static |
Given an Expr for a value to be printed, emit the code to evaluate the expression and store the result to alloca'd memory. Update the argTypes string with the type encoding for this expression.
Definition at line 2650 of file stmt.cpp.
References FunctionEmitContext::AllocaInst(), FunctionEmitContext::BitCastInst(), Type::Equal(), Error(), Type::GetAsNonConstType(), Type::GetAsUniformType(), Type::GetString(), Expr::GetType(), Expr::GetValue(), Type::IsUniformType(), lEncodeType(), ASTNode::pos, FunctionEmitContext::StoreInst(), AtomicType::UniformBool, AtomicType::UniformInt16, AtomicType::UniformInt32, AtomicType::UniformInt8, AtomicType::UniformUInt16, AtomicType::UniformUInt8, AtomicType::VaryingInt32, and LLVMTypes::VoidPointerType.
Referenced by PrintStmt::EmitCode().
|
static |
Definition at line 2228 of file stmt.cpp.
References Error(), ASTNode::pos, and CaseStmt::value.
Referenced by SwitchStmt::EmitCode().
|
static |
Definition at line 1154 of file stmt.cpp.
References FunctionEmitContext::BinaryOperator(), FunctionEmitContext::BroadcastValue(), g, Target::getVectorWidth(), LLVMTypes::Int32VectorType, ISPC_MAX_NVEC, LLVMInt32Vector(), FunctionEmitContext::LoadInst(), FunctionEmitContext::StoreInst(), and Globals::target.
Referenced by ForeachStmt::EmitCode().
Postorder callback function for checking for varying breaks or continues; decrement the varying control flow depth after the node's children have been processed, if this is a varying if statement.
Definition at line 736 of file stmt.cpp.
References lIsVaryingFor(), and VaryingBCCheckInfo::varyingControlFlowDepth.
Referenced by lHasVaryingBreakOrContinue().
|
static |
Preorder callback function for checking for varying breaks or continues.
Definition at line 708 of file stmt.cpp.
References VaryingBCCheckInfo::foundVaryingBreakOrContinue, lIsVaryingFor(), and VaryingBCCheckInfo::varyingControlFlowDepth.
Referenced by lHasVaryingBreakOrContinue().