Intel SPMD Program Compiler  1.9.1
Functions | Variables
type.cpp File Reference

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

#include "type.h"
#include "expr.h"
#include "sym.h"
#include "llvmutil.h"
#include "module.h"
#include <stdio.h>
#include <map>
#include <llvm/IR/Value.h>
#include <llvm/IR/Module.h>
#include <llvm/DebugInfo.h>
#include <llvm/DIBuilder.h>
#include <llvm/Support/Dwarf.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

static bool lCheckTypeEquality ( const Type a,
const Type b,
bool  ignoreConst 
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 83 of file type.cpp.

References Module::diBuilder, and m.

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

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 2211 of file type.cpp.

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

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

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

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 70 of file type.cpp.

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

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 3319 of file type.cpp.

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

Referenced by Type::MoreGeneralType().

Variable Documentation

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

Definition at line 1907 of file type.cpp.