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

Definitions for classes related to type representation. More...

#include "type.h"
#include "expr.h"
#include "llvmutil.h"
#include "module.h"
#include "sym.h"
#include <llvm/BinaryFormat/Dwarf.h>
#include <llvm/IR/DIBuilder.h>
#include <llvm/IR/DebugInfo.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Value.h>
#include <llvm/Support/MathExtras.h>
#include <map>
#include <stdio.h>
Include dependency graph for type.cpp:

Go to the source code of this file.

Functions

static bool lShouldPrintName (const std::string &name)
 
static llvm::DIType * lCreateDIArray (llvm::DIType *eltType, int count)
 
static llvm::Type * lGetAtomicLLVMType (llvm::LLVMContext *ctx, const AtomicType *aType, bool isStorageType)
 
static llvm::Type * lGetVectorLLVMType (llvm::LLVMContext *ctx, const VectorType *vType, bool isStorage)
 
static std::string lMangleStructName (const std::string &name, Variability variability)
 
static std::string lMangleStruct (Variability variability, bool isConst, const std::string &name)
 
static const TypelVectorConvert (const Type *type, SourcePos pos, const char *reason, int vecSize)
 
static bool lCheckTypeEquality (const Type *a, const Type *b, bool ignoreConst)
 

Variables

static std::map< std::string, llvm::StructType * > lStructTypeMap
 

Detailed Description

Definitions for classes related to type representation.

Definition in file type.cpp.

Function Documentation

◆ lCheckTypeEquality()

static bool lCheckTypeEquality ( const Type a,
const Type b,
bool  ignoreConst 
)
static

◆ lCreateDIArray()

static llvm::DIType* lCreateDIArray ( llvm::DIType *  eltType,
int  count 
)
static

Utility routine to create a llvm array type of the given number of the given element type.

Definition at line 70 of file type.cpp.

References Module::diBuilder, and m.

Referenced by EnumType::GetDIType(), PointerType::GetDIType(), and ArrayType::GetDIType().

◆ lGetAtomicLLVMType()

static llvm::Type* lGetAtomicLLVMType ( llvm::LLVMContext *  ctx,
const AtomicType aType,
bool  isStorageType 
)
static

◆ lGetVectorLLVMType()

static llvm::Type* lGetVectorLLVMType ( llvm::LLVMContext *  ctx,
const VectorType vType,
bool  isStorage 
)
static

◆ lMangleStruct()

static std::string lMangleStruct ( Variability  variability,
bool  isConst,
const std::string &  name 
)
static

Mangle a struct name for use in function name mangling.

Definition at line 1772 of file type.cpp.

References Assert, Variability::MangleString(), and Variability::Unbound.

Referenced by StructType::Mangle(), and UndefinedStructType::Mangle().

◆ lMangleStructName()

static std::string lMangleStructName ( const std::string &  name,
Variability  variability 
)
static

Using a struct's name, its variability, and the vector width for the current compilation target, this function generates a string that encodes that full structure type, for use in the lStructTypeMap. Note that the vector width is needed in order to differentiate between 'varying' structs with different compilation targets, which have different memory layouts...

Definition at line 1538 of file type.cpp.

References FATAL, g, Target::getVectorWidth(), Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, Variability::Uniform, and Variability::Varying.

Referenced by StructType::GetCStructName(), StructType::LLVMType(), UndefinedStructType::LLVMType(), StructType::StructType(), and UndefinedStructType::UndefinedStructType().

◆ lShouldPrintName()

static bool lShouldPrintName ( const std::string &  name)
static

Utility routine used in code that prints out declarations; returns true if the given name should be printed, false otherwise. This allows us to omit the names for various internal things (whose names start with double underscores) and emit anonymous declarations for them instead.

Definition at line 59 of file type.cpp.

Referenced by AtomicType::GetCDeclaration(), EnumType::GetCDeclaration(), StructType::GetCDeclaration(), UndefinedStructType::GetCDeclaration(), and ReferenceType::GetCDeclaration().

◆ lVectorConvert()

static const Type* lVectorConvert ( const Type type,
SourcePos  pos,
const char *  reason,
int  vecSize 
)
static

Given an atomic or vector type, return a vector type of the given vecSize. Issue an error if given a vector type that isn't already that size.

Definition at line 2578 of file type.cpp.

References Error(), VectorType::GetElementCount(), and Type::GetString().

Referenced by Type::MoreGeneralType().

Variable Documentation

◆ lStructTypeMap

std::map<std::string, llvm::StructType *> lStructTypeMap
static