43 #include <llvm/ADT/SmallVector.h> 44 #include <llvm/IR/DerivedTypes.h> 45 #include <llvm/IR/Type.h> 95 virtual bool IsBoolType()
const = 0;
100 virtual bool IsFloatType()
const = 0;
105 virtual bool IsIntType()
const = 0;
110 virtual bool IsUnsignedType()
const = 0;
113 bool IsPointerType()
const;
116 bool IsArrayType()
const;
122 bool IsVoidType()
const;
125 virtual bool IsConstType()
const = 0;
154 virtual const Type *ResolveUnboundVariability(
Variability v)
const = 0;
158 virtual const Type *GetAsUniformType()
const = 0;
162 virtual const Type *GetAsVaryingType()
const = 0;
165 virtual const Type *GetAsUnboundVariabilityType()
const = 0;
167 virtual const Type *GetAsSOAType(
int width)
const = 0;
171 virtual const Type *GetAsUnsignedType()
const;
176 virtual const Type *GetBaseType()
const = 0;
180 virtual const Type *GetReferenceTarget()
const;
184 virtual const Type *GetAsConstType()
const = 0;
188 virtual const Type *GetAsNonConstType()
const = 0;
192 virtual std::string
GetString()
const = 0;
199 virtual std::string Mangle()
const = 0;
203 virtual std::string GetCDeclaration(
const std::string &name)
const = 0;
206 virtual llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const = 0;
209 virtual llvm::Type *LLVMStorageType(llvm::LLVMContext *ctx)
const;
213 virtual llvm::DIType *GetDIType(llvm::DIScope *scope)
const = 0;
217 static bool Equal(
const Type *a,
const Type *b);
221 static bool EqualIgnoringConst(
const Type *a,
const Type *b);
245 static const Type *MoreGeneralType(
const Type *type0,
const Type *type1,
SourcePos pos,
const char *reason,
246 bool forceVarying =
false,
int vecSize = 0);
251 static bool IsBasicType(
const Type *
type);
274 bool IsBoolType()
const;
275 bool IsFloatType()
const;
276 bool IsIntType()
const;
277 bool IsUnsignedType()
const;
278 bool IsConstType()
const;
285 const AtomicType *GetAsUnboundVariabilityType()
const;
286 const AtomicType *GetAsSOAType(
int width)
const;
294 std::string Mangle()
const;
295 std::string GetCDeclaration(
const std::string &name)
const;
297 llvm::Type *LLVMStorageType(llvm::LLVMContext *ctx)
const;
298 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
300 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
356 bool IsBoolType()
const;
357 bool IsFloatType()
const;
358 bool IsIntType()
const;
359 bool IsUnsignedType()
const;
360 bool IsConstType()
const;
362 const EnumType *GetBaseType()
const;
363 const EnumType *GetAsVaryingType()
const;
364 const EnumType *GetAsUniformType()
const;
365 const EnumType *GetAsUnboundVariabilityType()
const;
366 const EnumType *GetAsSOAType(
int width)
const;
369 const EnumType *GetAsConstType()
const;
370 const EnumType *GetAsNonConstType()
const;
373 std::string Mangle()
const;
374 std::string GetCDeclaration(
const std::string &name)
const;
379 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
381 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
384 void SetEnumerators(
const std::vector<Symbol *> &enumerators);
386 int GetEnumeratorCount()
const;
388 const Symbol *GetEnumerator(
int i)
const;
429 static bool IsVoidPointer(
const Type *t);
433 bool IsBoolType()
const;
434 bool IsFloatType()
const;
435 bool IsIntType()
const;
436 bool IsUnsignedType()
const;
437 bool IsConstType()
const;
445 const Type *GetBaseType()
const;
448 const PointerType *GetAsUnboundVariabilityType()
const;
456 std::string Mangle()
const;
457 std::string GetCDeclaration(
const std::string &name)
const;
459 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
461 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
481 virtual int GetElementCount()
const = 0;
486 virtual const Type *GetElementType(
int index)
const = 0;
502 virtual const Type *GetElementType()
const = 0;
509 const Type *GetElementType(
int index)
const;
539 bool IsBoolType()
const;
540 bool IsFloatType()
const;
541 bool IsIntType()
const;
542 bool IsUnsignedType()
const;
543 bool IsConstType()
const;
545 const Type *GetBaseType()
const;
546 const ArrayType *GetAsVaryingType()
const;
547 const ArrayType *GetAsUniformType()
const;
548 const ArrayType *GetAsUnboundVariabilityType()
const;
549 const ArrayType *GetAsSOAType(
int width)
const;
552 const ArrayType *GetAsUnsignedType()
const;
554 const ArrayType *GetAsNonConstType()
const;
557 std::string Mangle()
const;
558 std::string GetCDeclaration(
const std::string &name)
const;
560 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
561 llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx)
const;
565 int TotalElementCount()
const;
567 int GetElementCount()
const;
568 const Type *GetElementType()
const;
572 virtual ArrayType *GetSizedArray(
int length)
const;
606 bool IsBoolType()
const;
607 bool IsFloatType()
const;
608 bool IsIntType()
const;
609 bool IsUnsignedType()
const;
610 bool IsConstType()
const;
612 const Type *GetBaseType()
const;
615 const VectorType *GetAsUnboundVariabilityType()
const;
616 const VectorType *GetAsSOAType(
int width)
const;
624 std::string Mangle()
const;
625 std::string GetCDeclaration(
const std::string &name)
const;
627 llvm::Type *LLVMStorageType(llvm::LLVMContext *ctx)
const;
628 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
630 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
632 int GetElementCount()
const;
645 int getVectorMemoryCount()
const;
652 StructType(
const std::string &name,
const llvm::SmallVector<const Type *, 8> &elts,
653 const llvm::SmallVector<std::string, 8> &eltNames,
const llvm::SmallVector<SourcePos, 8> &eltPositions,
658 bool IsBoolType()
const;
659 bool IsFloatType()
const;
660 bool IsIntType()
const;
661 bool IsUnsignedType()
const;
662 bool IsConstType()
const;
663 bool IsDefined()
const;
665 const Type *GetBaseType()
const;
668 const StructType *GetAsUnboundVariabilityType()
const;
669 const StructType *GetAsSOAType(
int width)
const;
676 std::string Mangle()
const;
677 std::string GetCDeclaration(
const std::string &name)
const;
679 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
681 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
685 const Type *GetElementType(
const std::string &name)
const;
689 const Type *GetElementType(
int i)
const;
693 int GetElementNumber(
const std::string &name)
const;
705 const std::string GetCStructName()
const;
708 static bool checkIfCanBeSOA(
const StructType *st);
746 bool IsBoolType()
const;
747 bool IsFloatType()
const;
748 bool IsIntType()
const;
749 bool IsUnsignedType()
const;
750 bool IsConstType()
const;
752 const Type *GetBaseType()
const;
763 std::string Mangle()
const;
764 std::string GetCDeclaration(
const std::string &name)
const;
766 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
768 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
788 bool IsBoolType()
const;
789 bool IsFloatType()
const;
790 bool IsIntType()
const;
791 bool IsUnsignedType()
const;
792 bool IsConstType()
const;
794 const Type *GetBaseType()
const;
795 const Type *GetReferenceTarget()
const;
799 const Type *GetAsSOAType(
int width)
const;
806 std::string Mangle()
const;
807 std::string GetCDeclaration(
const std::string &name)
const;
809 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
811 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
832 FunctionType(
const Type *returnType,
const llvm::SmallVector<const Type *, 8> &argTypes,
833 const llvm::SmallVector<std::string, 8> &argNames,
const llvm::SmallVector<Expr *, 8> &argDefaults,
834 const llvm::SmallVector<SourcePos, 8> &argPos,
bool isTask,
bool isExported,
bool isExternC,
839 bool IsBoolType()
const;
840 bool IsFloatType()
const;
841 bool IsIntType()
const;
842 bool IsUnsignedType()
const;
843 bool IsConstType()
const;
845 const Type *GetBaseType()
const;
846 const Type *GetAsVaryingType()
const;
847 const Type *GetAsUniformType()
const;
848 const Type *GetAsUnboundVariabilityType()
const;
849 const Type *GetAsSOAType(
int width)
const;
852 const Type *GetAsConstType()
const;
853 const Type *GetAsNonConstType()
const;
856 std::string Mangle()
const;
857 std::string GetCDeclaration(
const std::string &fname)
const;
858 std::string GetCDeclarationForDispatch(
const std::string &fname)
const;
860 llvm::Type *LLVMType(llvm::LLVMContext *ctx)
const;
862 llvm::DIType *GetDIType(llvm::DIScope *scope)
const;
866 const std::string GetReturnTypeString()
const;
872 llvm::FunctionType *LLVMFunctionType(llvm::LLVMContext *ctx,
bool disableMask =
false)
const;
875 const Type *GetParameterType(
int i)
const;
876 Expr *GetParameterDefault(
int i)
const;
877 const SourcePos &GetParameterSourcePos(
int i)
const;
878 const std::string &GetParameterName(
int i)
const;
static const AtomicType * VaryingInt32
llvm::SmallVector< Expr *, 8 > paramDefaults
bool operator!=(const VarType &t) const
const StructType * oppositeConstStructType
static const AtomicType * VaryingInt16
bool IsUniformType() const
bool operator!=(const Variability &v) const
const Type * GetReturnType() const
static const AtomicType * VaryingUInt64
bool IsVaryingType() const
static PointerType * Void
bool IsFrozenSlice() const
std::string GetString() const
static const AtomicType * VaryingDouble
Expression representing a compile-time constant value.
Abstract base class for types that represent sequences.
const std::string & GetStructName() const
const std::string & GetStructName() const
int GetNumParameters() const
const Variability variability
bool operator==(const Variability &v) const
Type implementation for pointers to other types.
const Variability variability
const llvm::SmallVector< std::string, 8 > paramNames
std::string MangleString() const
Type representing a reference to another (non-reference) type.
const std::string & GetEnumName() const
const llvm::SmallVector< std::string, 8 > elementNames
std::vector< Symbol * > enumerators
bool IsReferenceType(const Type *t)
const SourcePos & GetElementPosition(int i) const
const llvm::SmallVector< SourcePos, 8 > elementPositions
llvm::SmallVector< const Type *, 8 > finalElementTypes
Representation of a structure holding a number of members.
const std::string & GetElementName(int i) const
const AtomicType *const base
const AtomicType * asVaryingType
CollectionType(TypeId id)
AtomicType represents basic types like floats, ints, etc.
const Type *const returnType
Representation of a range of positions in a source file.
SequentialType(TypeId id)
Type implementation for enumerated types.
static const AtomicType * VaryingBool
Abstract base class for types that represent collections of other types.
int GetElementCount() const
const BasicType basicType
const Type *const targetType
static const AtomicType * VaryingInt64
const llvm::SmallVector< const Type *, 8 > elementTypes
const Variability variability
A (short) vector of atomic types.
const llvm::SmallVector< SourcePos, 8 > paramPositions
const T * CastType(const Type *type)
static const AtomicType * VaryingUInt16
static const AtomicType * VaryingInt8
Type representing a function (return type + argument types)
Representation of a program symbol.
const llvm::SmallVector< const Type *, 8 > paramTypes
Variability(VarType t=Unbound, int w=0)
Interface class that defines the type abstraction.
static const AtomicType * Void
Expr is the abstract base class that defines the interface that all expression types must implement...
static const AtomicType * VaryingUInt8
Main ispc.header file. Defines Target, Globals and Opt classes.
const ReferenceType * asOtherConstType
bool IsNumericType() const
static const AtomicType * VaryingUInt32
static const AtomicType * VaryingFloat
bool operator==(const VarType &t) const
bool HasUnboundVariability() const
One-dimensional array type.
const Variability variability