Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
Classes | Functions
ctx.cpp File Reference

Implementation of the FunctionEmitContext class. More...

#include "ctx.h"
#include "expr.h"
#include "func.h"
#include "llvmutil.h"
#include "module.h"
#include "stmt.h"
#include "sym.h"
#include "type.h"
#include "util.h"
#include <llvm/BinaryFormat/Dwarf.h>
#include <map>
#include <llvm/IR/DerivedTypes.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/Metadata.h>
#include <llvm/IR/Module.h>
Include dependency graph for ctx.cpp:

Go to the source code of this file.

Classes

struct  CFInfo
 

Functions

static bool lEnclosingLoopIsForeachActive (const std::vector< CFInfo *> &controlFlowInfo)
 
static llvm::Value * lGetStringAsValue (llvm::BasicBlock *bblock, const char *s)
 
static int lArrayVectorWidth (llvm::Type *t)
 
static llvm::Type * lGetMatchingBoolVectorType (llvm::Type *type)
 
static llvm::Value * lComputeSliceIndex (FunctionEmitContext *ctx, int soaWidth, llvm::Value *indexValue, llvm::Value *ptrSliceOffset, llvm::Value **newSliceOffset)
 
static llvm::Value * lFinalSliceOffset (FunctionEmitContext *ctx, llvm::Value *ptr, const PointerType **ptrType)
 
static unsigned int lCalleeArgCount (llvm::Value *callee, const FunctionType *funcType)
 

Detailed Description

Implementation of the FunctionEmitContext class.

Definition in file ctx.cpp.

Function Documentation

◆ lArrayVectorWidth()

static int lArrayVectorWidth ( llvm::Type *  t)
static

If the given type is an array of vector types, then it's the representation of an ispc VectorType with varying elements. If it is one of these, return the array size (i.e. the VectorType's size). Otherwise return zero.

Definition at line 1370 of file ctx.cpp.

References Assert, g, Target::getVectorWidth(), and Globals::target.

Referenced by FunctionEmitContext::BinaryOperator(), FunctionEmitContext::CmpInst(), and FunctionEmitContext::NotOperator().

◆ lCalleeArgCount()

static unsigned int lCalleeArgCount ( llvm::Value *  callee,
const FunctionType funcType 
)
static

Given a value representing a function to be called or possibly-varying pointer to a function to be called, figure out how many arguments the function has.

Definition at line 2958 of file ctx.cpp.

References Assert, and FunctionType::GetNumParameters().

Referenced by FunctionEmitContext::CallInst().

◆ lComputeSliceIndex()

static llvm::Value* lComputeSliceIndex ( FunctionEmitContext ctx,
int  soaWidth,
llvm::Value *  indexValue,
llvm::Value *  ptrSliceOffset,
llvm::Value **  newSliceOffset 
)
static

Given an integer index in indexValue that's indexing into an array of soa<> structures with given soaWidth, compute the two sub-indices we need to do the actual indexing calculation:

subIndices[0] = (indexValue >> log(soaWidth)) subIndices[1] = (indexValue & (soaWidth-1))

Definition at line 1779 of file ctx.cpp.

References Assert, FunctionEmitContext::BinaryOperator(), LLVMTypes::Int32Type, LLVMTypes::Int32VectorType, LLVMTypes::Int64Type, LLVMTypes::Int64VectorType, LLVMIntAsType(), FunctionEmitContext::MatchIntegerTypes(), and FunctionEmitContext::TruncInst().

Referenced by FunctionEmitContext::GetElementPtrInst().

◆ lEnclosingLoopIsForeachActive()

static bool lEnclosingLoopIsForeachActive ( const std::vector< CFInfo *> &  controlFlowInfo)
static

Definition at line 652 of file ctx.cpp.

References CFInfo::ForeachActive, and CFInfo::type.

Referenced by FunctionEmitContext::Continue().

◆ lFinalSliceOffset()

static llvm::Value* lFinalSliceOffset ( FunctionEmitContext ctx,
llvm::Value *  ptr,
const PointerType **  ptrType 
)
static

◆ lGetMatchingBoolVectorType()

static llvm::Type* lGetMatchingBoolVectorType ( llvm::Type *  type)
static

◆ lGetStringAsValue()

static llvm::Value* lGetStringAsValue ( llvm::BasicBlock *  bblock,
const char *  s 
)
static

Definition at line 1258 of file ctx.cpp.

References Globals::ctx, g, LLVMInt32(), m, Module::module, and PTYPE.

Referenced by FunctionEmitContext::AddInstrumentationPoint().