Intel SPMD Program Compiler  1.9.1
Classes | Functions
ctx.cpp File Reference

Implementation of the FunctionEmitContext class. More...

#include "ctx.h"
#include "util.h"
#include "func.h"
#include "llvmutil.h"
#include "type.h"
#include "stmt.h"
#include "expr.h"
#include "module.h"
#include "sym.h"
#include <map>
#include <llvm/Support/Dwarf.h>
#include <llvm/IR/Metadata.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/DerivedTypes.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

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 1887 of file ctx.cpp.

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

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

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 3618 of file ctx.cpp.

References Assert, and FunctionType::GetNumParameters().

Referenced by FunctionEmitContext::CallInst().

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 2373 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().

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

Definition at line 826 of file ctx.cpp.

References CFInfo::ForeachActive.

Referenced by FunctionEmitContext::Continue().

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

Definition at line 1974 of file ctx.cpp.

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

Referenced by FunctionEmitContext::CmpInst().

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

Definition at line 1620 of file ctx.cpp.

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

Referenced by FunctionEmitContext::AddInstrumentationPoint().