Skip to content

Commit

Permalink
Reflect changes in LLVM's type system.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Wendleder authored and Matt Pharr committed Jul 13, 2011
1 parent a535aa5 commit 646db5a
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 87 deletions.
26 changes: 13 additions & 13 deletions builtins.cpp
Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -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 =
Expand All @@ -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);
Expand Down
52 changes: 26 additions & 26 deletions llvmutil.cpp
Expand Up @@ -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;

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::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;

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;
Expand Down
52 changes: 26 additions & 26 deletions llvmutil.h
Expand Up @@ -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 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::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 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
Expand Down
28 changes: 14 additions & 14 deletions type.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -730,7 +730,7 @@ SOAArrayType::TotalElementCount() const {
}


const llvm::ArrayType *
llvm::ArrayType *
SOAArrayType::LLVMType(llvm::LLVMContext *ctx) const {
if (!child)
return NULL;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 646db5a

Please sign in to comment.