Intel SPMD Program Compiler  1.12.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 <map>
#include <llvm/Support/Dwarf.h>
#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.


struct  CFInfo


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)

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 1595 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 

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 3095 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 

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 1999 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)

Definition at line 716 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 

◆ lGetMatchingBoolVectorType()

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

◆ lGetStringAsValue()

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

Definition at line 1398 of file ctx.cpp.

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

Referenced by FunctionEmitContext::AddInstrumentationPoint().