Reflect changes in LLVM's type system.

This commit is contained in:
Andreas Wendleder
2011-07-12 21:21:57 +02:00
committed by Matt Pharr
parent a535aa586b
commit 646db5aacb
5 changed files with 85 additions and 85 deletions

View File

@@ -265,7 +265,7 @@ lDeclarePseudoGathers(llvm::Module *module) {
noPos.name = "__stdlib";
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -285,7 +285,7 @@ lDeclarePseudoGathers(llvm::Module *module) {
}
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerType);
argTypes.push_back(LLVMTypes::Int32VectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -331,7 +331,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
noPos.name = "__stdlib";
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
argTypes.push_back(LLVMTypes::Int32VectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -344,7 +344,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
func->setDoesNotThrow(true);
}
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
argTypes.push_back(LLVMTypes::Int64VectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -358,7 +358,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
}
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerType);
argTypes.push_back(LLVMTypes::Int32VectorType);
argTypes.push_back(LLVMTypes::Int32VectorType);
@@ -372,7 +372,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
func->setDoesNotThrow(true);
}
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerType);
argTypes.push_back(LLVMTypes::Int32VectorType);
argTypes.push_back(LLVMTypes::Int64VectorType);
@@ -404,7 +404,7 @@ lDeclarePseudoMaskedStore(llvm::Module *module) {
noPos.name = "__stdlib";
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::Int32VectorPointerType);
argTypes.push_back(LLVMTypes::Int32VectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -420,7 +420,7 @@ lDeclarePseudoMaskedStore(llvm::Module *module) {
}
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::Int64VectorPointerType);
argTypes.push_back(LLVMTypes::Int64VectorType);
argTypes.push_back(LLVMTypes::MaskType);
@@ -550,7 +550,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// Add a declaration of void *ISPCMalloc(int64_t size, int alignment).
// The user is responsible for linking in a definition of this if it's
// needed by the compiled program.
{ std::vector<const llvm::Type *> argTypes;
{ std::vector<llvm::Type *> argTypes;
argTypes.push_back(llvm::Type::getInt64Ty(*ctx));
argTypes.push_back(llvm::Type::getInt32Ty(*ctx));
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidPointerType,
@@ -564,7 +564,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// Add a declaration of void ISPCFree(void *). The user is
// responsible for linking in a definition of this if it's needed by
// the compiled program.
{ std::vector<const llvm::Type *> argTypes;
{ std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerType);
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidPointerType,
argTypes, false);
@@ -577,7 +577,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// Add a declaration of void ISPCLaunch(void *funcPtr, void *data).
// The user is responsible for linking in a definition of this if it's
// needed by the compiled program.
{ std::vector<const llvm::Type *> argTypes;
{ std::vector<llvm::Type *> argTypes;
argTypes.push_back(LLVMTypes::VoidPointerType);
argTypes.push_back(LLVMTypes::VoidPointerType);
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidType,
@@ -592,7 +592,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// linking in a definition of this if it's needed by the compiled
// program.
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidType,
argTypes, false);
llvm::Function *func =
@@ -605,7 +605,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// The user is responsible for linking in a definition of this if it's
// needed by the compiled program.
{
std::vector<const llvm::Type *> argTypes;
std::vector<llvm::Type *> argTypes;
argTypes.push_back(llvm::PointerType::get(llvm::Type::getInt8Ty(*g->ctx), 0));
argTypes.push_back(llvm::PointerType::get(llvm::Type::getInt8Ty(*g->ctx), 0));
argTypes.push_back(LLVMTypes::Int32Type);

View File

@@ -38,32 +38,32 @@
#include "llvmutil.h"
#include "type.h"
const llvm::Type *LLVMTypes::VoidType = NULL;
const llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
const llvm::Type *LLVMTypes::BoolType = NULL;
const llvm::Type *LLVMTypes::Int8Type = NULL;
const llvm::Type *LLVMTypes::Int16Type = NULL;
const llvm::Type *LLVMTypes::Int32Type = NULL;
const llvm::Type *LLVMTypes::Int32PointerType = NULL;
const llvm::Type *LLVMTypes::Int64Type = NULL;
const llvm::Type *LLVMTypes::Int64PointerType = NULL;
const llvm::Type *LLVMTypes::FloatType = NULL;
const llvm::Type *LLVMTypes::FloatPointerType = NULL;
const llvm::Type *LLVMTypes::DoubleType = NULL;
const llvm::Type *LLVMTypes::DoublePointerType = NULL;
llvm::Type *LLVMTypes::VoidType = NULL;
llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
llvm::Type *LLVMTypes::BoolType = NULL;
llvm::Type *LLVMTypes::Int8Type = NULL;
llvm::Type *LLVMTypes::Int16Type = NULL;
llvm::Type *LLVMTypes::Int32Type = NULL;
llvm::Type *LLVMTypes::Int32PointerType = NULL;
llvm::Type *LLVMTypes::Int64Type = NULL;
llvm::Type *LLVMTypes::Int64PointerType = NULL;
llvm::Type *LLVMTypes::FloatType = NULL;
llvm::Type *LLVMTypes::FloatPointerType = NULL;
llvm::Type *LLVMTypes::DoubleType = NULL;
llvm::Type *LLVMTypes::DoublePointerType = NULL;
const llvm::VectorType *LLVMTypes::MaskType = NULL;
const llvm::VectorType *LLVMTypes::BoolVectorType = NULL;
const llvm::VectorType *LLVMTypes::Int1VectorType = NULL;
const llvm::VectorType *LLVMTypes::Int32VectorType = NULL;
const llvm::Type *LLVMTypes::Int32VectorPointerType = NULL;
const llvm::VectorType *LLVMTypes::Int64VectorType = NULL;
const llvm::Type *LLVMTypes::Int64VectorPointerType = NULL;
const llvm::VectorType *LLVMTypes::FloatVectorType = NULL;
const llvm::Type *LLVMTypes::FloatVectorPointerType = NULL;
const llvm::VectorType *LLVMTypes::DoubleVectorType = NULL;
const llvm::Type *LLVMTypes::DoubleVectorPointerType = NULL;
const llvm::ArrayType *LLVMTypes::VoidPointerVectorType = NULL;
llvm::VectorType *LLVMTypes::MaskType = NULL;
llvm::VectorType *LLVMTypes::BoolVectorType = NULL;
llvm::VectorType *LLVMTypes::Int1VectorType = NULL;
llvm::VectorType *LLVMTypes::Int32VectorType = NULL;
llvm::Type *LLVMTypes::Int32VectorPointerType = NULL;
llvm::VectorType *LLVMTypes::Int64VectorType = NULL;
llvm::Type *LLVMTypes::Int64VectorPointerType = NULL;
llvm::VectorType *LLVMTypes::FloatVectorType = NULL;
llvm::Type *LLVMTypes::FloatVectorPointerType = NULL;
llvm::VectorType *LLVMTypes::DoubleVectorType = NULL;
llvm::Type *LLVMTypes::DoubleVectorPointerType = NULL;
llvm::ArrayType *LLVMTypes::VoidPointerVectorType = NULL;
llvm::Constant *LLVMTrue = NULL;
llvm::Constant *LLVMFalse = NULL;

View File

@@ -49,32 +49,32 @@
verbose LLVM API calls.
*/
struct LLVMTypes {
static const llvm::Type *VoidType;
static const llvm::PointerType *VoidPointerType;
static const llvm::Type *BoolType;
static const llvm::Type *Int8Type;
static const llvm::Type *Int16Type;
static const llvm::Type *Int32Type;
static const llvm::Type *Int32PointerType;
static const llvm::Type *Int64Type;
static const llvm::Type *Int64PointerType;
static const llvm::Type *FloatType;
static const llvm::Type *FloatPointerType;
static const llvm::Type *DoubleType;
static const llvm::Type *DoublePointerType;
static llvm::Type *VoidType;
static llvm::PointerType *VoidPointerType;
static llvm::Type *BoolType;
static llvm::Type *Int8Type;
static llvm::Type *Int16Type;
static llvm::Type *Int32Type;
static llvm::Type *Int32PointerType;
static llvm::Type *Int64Type;
static llvm::Type *Int64PointerType;
static llvm::Type *FloatType;
static llvm::Type *FloatPointerType;
static llvm::Type *DoubleType;
static llvm::Type *DoublePointerType;
static const llvm::VectorType *MaskType;
static const llvm::VectorType *BoolVectorType;
static const llvm::VectorType *Int1VectorType;
static const llvm::VectorType *Int32VectorType;
static const llvm::Type *Int32VectorPointerType;
static const llvm::VectorType *Int64VectorType;
static const llvm::Type *Int64VectorPointerType;
static const llvm::VectorType *FloatVectorType;
static const llvm::Type *FloatVectorPointerType;
static const llvm::VectorType *DoubleVectorType;
static const llvm::Type *DoubleVectorPointerType;
static const llvm::ArrayType *VoidPointerVectorType;
static llvm::VectorType *MaskType;
static llvm::VectorType *BoolVectorType;
static llvm::VectorType *Int1VectorType;
static llvm::VectorType *Int32VectorType;
static llvm::Type *Int32VectorPointerType;
static llvm::VectorType *Int64VectorType;
static llvm::Type *Int64VectorPointerType;
static llvm::VectorType *FloatVectorType;
static llvm::Type *FloatVectorPointerType;
static llvm::VectorType *DoubleVectorType;
static llvm::Type *DoubleVectorPointerType;
static llvm::ArrayType *VoidPointerVectorType;
};
/** These variables hold the corresponding LLVM constant values as a

View File

@@ -326,7 +326,7 @@ AtomicType::GetCDeclaration(const std::string &name) const {
}
const llvm::Type *
llvm::Type *
AtomicType::LLVMType(llvm::LLVMContext *ctx) const {
switch (basicType) {
case TYPE_VOID:
@@ -428,12 +428,12 @@ ArrayType::ArrayType(const Type *c, int a)
}
const llvm::ArrayType *
llvm::ArrayType *
ArrayType::LLVMType(llvm::LLVMContext *ctx) const {
if (!child)
return NULL;
const llvm::Type *ct = child->LLVMType(ctx);
llvm::Type *ct = child->LLVMType(ctx);
if (!ct)
return NULL;
return llvm::ArrayType::get(ct, numElements);
@@ -730,7 +730,7 @@ SOAArrayType::TotalElementCount() const {
}
const llvm::ArrayType *
llvm::ArrayType *
SOAArrayType::LLVMType(llvm::LLVMContext *ctx) const {
if (!child)
return NULL;
@@ -894,9 +894,9 @@ VectorType::GetElementType() const {
}
const llvm::Type *
llvm::Type *
VectorType::LLVMType(llvm::LLVMContext *ctx) const {
const llvm::Type *bt = base->LLVMType(ctx);
llvm::Type *bt = base->LLVMType(ctx);
if (!bt)
return NULL;
@@ -1130,9 +1130,9 @@ StructType::GetCDeclaration(const std::string &n) const {
}
const llvm::Type *
llvm::Type *
StructType::LLVMType(llvm::LLVMContext *ctx) const {
std::vector<const llvm::Type *> llvmTypes;
std::vector<llvm::Type *> llvmTypes;
for (int i = 0; i < GetElementCount(); ++i) {
const Type *type = GetElementType(i);
llvmTypes.push_back(type->LLVMType(ctx));
@@ -1385,11 +1385,11 @@ ReferenceType::GetCDeclaration(const std::string &name) const {
}
const llvm::Type *
llvm::Type *
ReferenceType::LLVMType(llvm::LLVMContext *ctx) const {
if (!targetType)
return NULL;
const llvm::Type *t = targetType->LLVMType(ctx);
llvm::Type *t = targetType->LLVMType(ctx);
if (!t)
return NULL;
return llvm::PointerType::get(t, 0);
@@ -1542,7 +1542,7 @@ FunctionType::GetCDeclaration(const std::string &fname) const {
}
const llvm::Type *
llvm::Type *
FunctionType::LLVMType(llvm::LLVMContext *ctx) const {
FATAL("FunctionType::LLVMType() shouldn't be called");
return NULL;
@@ -1565,12 +1565,12 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
}
// Get the LLVM Type *s for the function arguments
std::vector<const llvm::Type *> llvmArgTypes;
std::vector<llvm::Type *> llvmArgTypes;
for (unsigned int i = 0; i < argTypes.size(); ++i) {
if (!argTypes[i])
return NULL;
const llvm::Type *t = argTypes[i]->LLVMType(ctx);
llvm::Type *t = argTypes[i]->LLVMType(ctx);
if (!t)
return NULL;
llvmArgTypes.push_back(t);
@@ -1580,7 +1580,7 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
if (includeMask)
llvmArgTypes.push_back(LLVMTypes::MaskType);
std::vector<const llvm::Type *> callTypes;
std::vector<llvm::Type *> callTypes;
if (isTask) {
// Tasks take three arguments: a pointer to a struct that holds the
// actual task arguments, the thread index, and the total number of

16
type.h
View File

@@ -133,7 +133,7 @@ public:
virtual std::string GetCDeclaration(const std::string &name) const = 0;
/** Returns the LLVM type corresponding to this ispc type */
virtual const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const = 0;
virtual llvm::Type *LLVMType(llvm::LLVMContext *ctx) const = 0;
/** Returns the DIType (LLVM's debugging information structure),
corresponding to this type. */
@@ -202,7 +202,7 @@ public:
std::string Mangle() const;
std::string GetCDeclaration(const std::string &name) const;
const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
/** This enumerant records the basic types that AtomicTypes can be
@@ -323,7 +323,7 @@ public:
std::string GetCDeclaration(const std::string &name) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
const llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
/** This method returns the total number of elements in the array,
including all dimensions if this is a multidimensional array. */
@@ -392,7 +392,7 @@ public:
int TotalElementCount() const;
const llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
SOAArrayType *GetSizedArray(int size) const;
@@ -441,7 +441,7 @@ public:
std::string Mangle() const;
std::string GetCDeclaration(const std::string &name) const;
const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
int GetElementCount() const;
@@ -487,7 +487,7 @@ public:
std::string Mangle() const;
std::string GetCDeclaration(const std::string &name) const;
const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
/** Returns the type of the structure element with the given name (if any).
@@ -559,7 +559,7 @@ public:
std::string Mangle() const;
std::string GetCDeclaration(const std::string &name) const;
const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
private:
@@ -605,7 +605,7 @@ public:
std::string Mangle() const;
std::string GetCDeclaration(const std::string &fname) const;
const llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
const Type *GetReturnType() const { return returnType; }