Intel SPMD Program Compiler  1.12.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 <map>
#include <stdio.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Value.h>
#include <llvm/DIBuilder.h>
#include <llvm/DebugInfo.h>
#include <llvm/Support/Dwarf.h>
#include <llvm/Support/MathExtras.h>
Include dependency graph for type.cpp:

Go to the source code of this file.


static bool lShouldPrintName (const std::string &name)
static llvm::DIType lCreateDIArray (llvm::DIType eltType, int count)
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)


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 

◆ lCreateDIArray()

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

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

Definition at line 85 of file type.cpp.

References Module::diBuilder, and m.

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

◆ lMangleStruct()

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

Mangle a struct name for use in function name mangling.

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

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

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

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

Definition at line 1661 of file type.cpp.