Fix LLVM 2.9 build.
This commit is contained in:
26
builtins.cpp
26
builtins.cpp
@@ -265,7 +265,7 @@ lDeclarePseudoGathers(llvm::Module *module) {
|
|||||||
noPos.name = "__stdlib";
|
noPos.name = "__stdlib";
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
argTypes.push_back(LLVMTypes::MaskType);
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ lDeclarePseudoGathers(llvm::Module *module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
argTypes.push_back(LLVMTypes::MaskType);
|
||||||
@@ -331,7 +331,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
|
|||||||
noPos.name = "__stdlib";
|
noPos.name = "__stdlib";
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
argTypes.push_back(LLVMTypes::MaskType);
|
||||||
@@ -344,7 +344,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
|
|||||||
func->setDoesNotThrow(true);
|
func->setDoesNotThrow(true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
argTypes.push_back(LLVMTypes::VoidPointerVectorType);
|
||||||
argTypes.push_back(LLVMTypes::Int64VectorType);
|
argTypes.push_back(LLVMTypes::Int64VectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
argTypes.push_back(LLVMTypes::MaskType);
|
||||||
@@ -358,7 +358,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
@@ -372,7 +372,7 @@ lDeclarePseudoScatters(llvm::Module *module) {
|
|||||||
func->setDoesNotThrow(true);
|
func->setDoesNotThrow(true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
argTypes.push_back(LLVMTypes::Int64VectorType);
|
argTypes.push_back(LLVMTypes::Int64VectorType);
|
||||||
@@ -404,7 +404,7 @@ lDeclarePseudoMaskedStore(llvm::Module *module) {
|
|||||||
noPos.name = "__stdlib";
|
noPos.name = "__stdlib";
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorPointerType);
|
argTypes.push_back(LLVMTypes::Int32VectorPointerType);
|
||||||
argTypes.push_back(LLVMTypes::Int32VectorType);
|
argTypes.push_back(LLVMTypes::Int32VectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
argTypes.push_back(LLVMTypes::MaskType);
|
||||||
@@ -420,7 +420,7 @@ lDeclarePseudoMaskedStore(llvm::Module *module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::Int64VectorPointerType);
|
argTypes.push_back(LLVMTypes::Int64VectorPointerType);
|
||||||
argTypes.push_back(LLVMTypes::Int64VectorType);
|
argTypes.push_back(LLVMTypes::Int64VectorType);
|
||||||
argTypes.push_back(LLVMTypes::MaskType);
|
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).
|
// 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
|
// The user is responsible for linking in a definition of this if it's
|
||||||
// needed by the compiled program.
|
// needed by the compiled program.
|
||||||
{ std::vector<llvm::Type *> argTypes;
|
{ std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(llvm::Type::getInt64Ty(*ctx));
|
argTypes.push_back(llvm::Type::getInt64Ty(*ctx));
|
||||||
argTypes.push_back(llvm::Type::getInt32Ty(*ctx));
|
argTypes.push_back(llvm::Type::getInt32Ty(*ctx));
|
||||||
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidPointerType,
|
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
|
// Add a declaration of void ISPCFree(void *). The user is
|
||||||
// responsible for linking in a definition of this if it's needed by
|
// responsible for linking in a definition of this if it's needed by
|
||||||
// the compiled program.
|
// the compiled program.
|
||||||
{ std::vector<llvm::Type *> argTypes;
|
{ std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidPointerType,
|
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidPointerType,
|
||||||
argTypes, false);
|
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).
|
// Add a declaration of void ISPCLaunch(void *funcPtr, void *data).
|
||||||
// The user is responsible for linking in a definition of this if it's
|
// The user is responsible for linking in a definition of this if it's
|
||||||
// needed by the compiled program.
|
// needed by the compiled program.
|
||||||
{ std::vector<llvm::Type *> argTypes;
|
{ std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
argTypes.push_back(LLVMTypes::VoidPointerType);
|
argTypes.push_back(LLVMTypes::VoidPointerType);
|
||||||
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidType,
|
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
|
// linking in a definition of this if it's needed by the compiled
|
||||||
// program.
|
// program.
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> argTypes;
|
||||||
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidType,
|
llvm::FunctionType *ftype = llvm::FunctionType::get(LLVMTypes::VoidType,
|
||||||
argTypes, false);
|
argTypes, false);
|
||||||
llvm::Function *func =
|
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
|
// The user is responsible for linking in a definition of this if it's
|
||||||
// needed by the compiled program.
|
// needed by the compiled program.
|
||||||
{
|
{
|
||||||
std::vector<llvm::Type *> argTypes;
|
std::vector<LLVM_TYPE_CONST 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(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);
|
argTypes.push_back(LLVMTypes::Int32Type);
|
||||||
|
|||||||
7
ispc.h
7
ispc.h
@@ -73,6 +73,13 @@ namespace llvm {
|
|||||||
class Value;
|
class Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// llvm::Type *s are no longer const in llvm 3.0
|
||||||
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||||
|
#define LLVM_TYPE_CONST
|
||||||
|
#else
|
||||||
|
#define LLVM_TYPE_CONST const
|
||||||
|
#endif
|
||||||
|
|
||||||
class ArrayType;
|
class ArrayType;
|
||||||
class AtomicType;
|
class AtomicType;
|
||||||
class DeclSpecs;
|
class DeclSpecs;
|
||||||
|
|||||||
50
llvmutil.cpp
50
llvmutil.cpp
@@ -38,32 +38,32 @@
|
|||||||
#include "llvmutil.h"
|
#include "llvmutil.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
|
|
||||||
llvm::Type *LLVMTypes::VoidType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::VoidType = NULL;
|
||||||
llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
|
LLVM_TYPE_CONST llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
|
||||||
llvm::Type *LLVMTypes::BoolType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::BoolType = NULL;
|
||||||
llvm::Type *LLVMTypes::Int8Type = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int8Type = NULL;
|
||||||
llvm::Type *LLVMTypes::Int16Type = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int16Type = NULL;
|
||||||
llvm::Type *LLVMTypes::Int32Type = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int32Type = NULL;
|
||||||
llvm::Type *LLVMTypes::Int32PointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int32PointerType = NULL;
|
||||||
llvm::Type *LLVMTypes::Int64Type = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int64Type = NULL;
|
||||||
llvm::Type *LLVMTypes::Int64PointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int64PointerType = NULL;
|
||||||
llvm::Type *LLVMTypes::FloatType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::FloatType = NULL;
|
||||||
llvm::Type *LLVMTypes::FloatPointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::FloatPointerType = NULL;
|
||||||
llvm::Type *LLVMTypes::DoubleType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::DoubleType = NULL;
|
||||||
llvm::Type *LLVMTypes::DoublePointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::DoublePointerType = NULL;
|
||||||
|
|
||||||
llvm::VectorType *LLVMTypes::MaskType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::MaskType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::BoolVectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::BoolVectorType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::Int1VectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::Int1VectorType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::Int32VectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::Int32VectorType = NULL;
|
||||||
llvm::Type *LLVMTypes::Int32VectorPointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int32VectorPointerType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::Int64VectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::Int64VectorType = NULL;
|
||||||
llvm::Type *LLVMTypes::Int64VectorPointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::Int64VectorPointerType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::FloatVectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::FloatVectorType = NULL;
|
||||||
llvm::Type *LLVMTypes::FloatVectorPointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::FloatVectorPointerType = NULL;
|
||||||
llvm::VectorType *LLVMTypes::DoubleVectorType = NULL;
|
LLVM_TYPE_CONST llvm::VectorType *LLVMTypes::DoubleVectorType = NULL;
|
||||||
llvm::Type *LLVMTypes::DoubleVectorPointerType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::DoubleVectorPointerType = NULL;
|
||||||
llvm::ArrayType *LLVMTypes::VoidPointerVectorType = NULL;
|
LLVM_TYPE_CONST llvm::ArrayType *LLVMTypes::VoidPointerVectorType = NULL;
|
||||||
|
|
||||||
llvm::Constant *LLVMTrue = NULL;
|
llvm::Constant *LLVMTrue = NULL;
|
||||||
llvm::Constant *LLVMFalse = NULL;
|
llvm::Constant *LLVMFalse = NULL;
|
||||||
|
|||||||
51
llvmutil.h
51
llvmutil.h
@@ -44,37 +44,38 @@
|
|||||||
#include <llvm/DerivedTypes.h>
|
#include <llvm/DerivedTypes.h>
|
||||||
#include <llvm/Constants.h>
|
#include <llvm/Constants.h>
|
||||||
|
|
||||||
|
|
||||||
/** This structure holds pointers to a variety of LLVM types; code
|
/** This structure holds pointers to a variety of LLVM types; code
|
||||||
elsewhere can use them from here, ratherthan needing to make more
|
elsewhere can use them from here, ratherthan needing to make more
|
||||||
verbose LLVM API calls.
|
verbose LLVM API calls.
|
||||||
*/
|
*/
|
||||||
struct LLVMTypes {
|
struct LLVMTypes {
|
||||||
static llvm::Type *VoidType;
|
static LLVM_TYPE_CONST llvm::Type *VoidType;
|
||||||
static llvm::PointerType *VoidPointerType;
|
static LLVM_TYPE_CONST llvm::PointerType *VoidPointerType;
|
||||||
static llvm::Type *BoolType;
|
static LLVM_TYPE_CONST llvm::Type *BoolType;
|
||||||
static llvm::Type *Int8Type;
|
static LLVM_TYPE_CONST llvm::Type *Int8Type;
|
||||||
static llvm::Type *Int16Type;
|
static LLVM_TYPE_CONST llvm::Type *Int16Type;
|
||||||
static llvm::Type *Int32Type;
|
static LLVM_TYPE_CONST llvm::Type *Int32Type;
|
||||||
static llvm::Type *Int32PointerType;
|
static LLVM_TYPE_CONST llvm::Type *Int32PointerType;
|
||||||
static llvm::Type *Int64Type;
|
static LLVM_TYPE_CONST llvm::Type *Int64Type;
|
||||||
static llvm::Type *Int64PointerType;
|
static LLVM_TYPE_CONST llvm::Type *Int64PointerType;
|
||||||
static llvm::Type *FloatType;
|
static LLVM_TYPE_CONST llvm::Type *FloatType;
|
||||||
static llvm::Type *FloatPointerType;
|
static LLVM_TYPE_CONST llvm::Type *FloatPointerType;
|
||||||
static llvm::Type *DoubleType;
|
static LLVM_TYPE_CONST llvm::Type *DoubleType;
|
||||||
static llvm::Type *DoublePointerType;
|
static LLVM_TYPE_CONST llvm::Type *DoublePointerType;
|
||||||
|
|
||||||
static llvm::VectorType *MaskType;
|
static LLVM_TYPE_CONST llvm::VectorType *MaskType;
|
||||||
static llvm::VectorType *BoolVectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *BoolVectorType;
|
||||||
static llvm::VectorType *Int1VectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *Int1VectorType;
|
||||||
static llvm::VectorType *Int32VectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *Int32VectorType;
|
||||||
static llvm::Type *Int32VectorPointerType;
|
static LLVM_TYPE_CONST llvm::Type *Int32VectorPointerType;
|
||||||
static llvm::VectorType *Int64VectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *Int64VectorType;
|
||||||
static llvm::Type *Int64VectorPointerType;
|
static LLVM_TYPE_CONST llvm::Type *Int64VectorPointerType;
|
||||||
static llvm::VectorType *FloatVectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *FloatVectorType;
|
||||||
static llvm::Type *FloatVectorPointerType;
|
static LLVM_TYPE_CONST llvm::Type *FloatVectorPointerType;
|
||||||
static llvm::VectorType *DoubleVectorType;
|
static LLVM_TYPE_CONST llvm::VectorType *DoubleVectorType;
|
||||||
static llvm::Type *DoubleVectorPointerType;
|
static LLVM_TYPE_CONST llvm::Type *DoubleVectorPointerType;
|
||||||
static llvm::ArrayType *VoidPointerVectorType;
|
static LLVM_TYPE_CONST llvm::ArrayType *VoidPointerVectorType;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** These variables hold the corresponding LLVM constant values as a
|
/** These variables hold the corresponding LLVM constant values as a
|
||||||
|
|||||||
28
type.cpp
28
type.cpp
@@ -326,7 +326,7 @@ AtomicType::GetCDeclaration(const std::string &name) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::Type *
|
LLVM_TYPE_CONST llvm::Type *
|
||||||
AtomicType::LLVMType(llvm::LLVMContext *ctx) const {
|
AtomicType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
switch (basicType) {
|
switch (basicType) {
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
@@ -428,12 +428,12 @@ ArrayType::ArrayType(const Type *c, int a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::ArrayType *
|
LLVM_TYPE_CONST llvm::ArrayType *
|
||||||
ArrayType::LLVMType(llvm::LLVMContext *ctx) const {
|
ArrayType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
if (!child)
|
if (!child)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
llvm::Type *ct = child->LLVMType(ctx);
|
LLVM_TYPE_CONST llvm::Type *ct = child->LLVMType(ctx);
|
||||||
if (!ct)
|
if (!ct)
|
||||||
return NULL;
|
return NULL;
|
||||||
return llvm::ArrayType::get(ct, numElements);
|
return llvm::ArrayType::get(ct, numElements);
|
||||||
@@ -730,7 +730,7 @@ SOAArrayType::TotalElementCount() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::ArrayType *
|
LLVM_TYPE_CONST llvm::ArrayType *
|
||||||
SOAArrayType::LLVMType(llvm::LLVMContext *ctx) const {
|
SOAArrayType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
if (!child)
|
if (!child)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -894,9 +894,9 @@ VectorType::GetElementType() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::Type *
|
LLVM_TYPE_CONST llvm::Type *
|
||||||
VectorType::LLVMType(llvm::LLVMContext *ctx) const {
|
VectorType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
llvm::Type *bt = base->LLVMType(ctx);
|
LLVM_TYPE_CONST llvm::Type *bt = base->LLVMType(ctx);
|
||||||
if (!bt)
|
if (!bt)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1130,9 +1130,9 @@ StructType::GetCDeclaration(const std::string &n) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::Type *
|
LLVM_TYPE_CONST llvm::Type *
|
||||||
StructType::LLVMType(llvm::LLVMContext *ctx) const {
|
StructType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
std::vector<llvm::Type *> llvmTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> llvmTypes;
|
||||||
for (int i = 0; i < GetElementCount(); ++i) {
|
for (int i = 0; i < GetElementCount(); ++i) {
|
||||||
const Type *type = GetElementType(i);
|
const Type *type = GetElementType(i);
|
||||||
llvmTypes.push_back(type->LLVMType(ctx));
|
llvmTypes.push_back(type->LLVMType(ctx));
|
||||||
@@ -1385,11 +1385,11 @@ ReferenceType::GetCDeclaration(const std::string &name) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::Type *
|
LLVM_TYPE_CONST llvm::Type *
|
||||||
ReferenceType::LLVMType(llvm::LLVMContext *ctx) const {
|
ReferenceType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
if (!targetType)
|
if (!targetType)
|
||||||
return NULL;
|
return NULL;
|
||||||
llvm::Type *t = targetType->LLVMType(ctx);
|
LLVM_TYPE_CONST llvm::Type *t = targetType->LLVMType(ctx);
|
||||||
if (!t)
|
if (!t)
|
||||||
return NULL;
|
return NULL;
|
||||||
return llvm::PointerType::get(t, 0);
|
return llvm::PointerType::get(t, 0);
|
||||||
@@ -1542,7 +1542,7 @@ FunctionType::GetCDeclaration(const std::string &fname) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llvm::Type *
|
LLVM_TYPE_CONST llvm::Type *
|
||||||
FunctionType::LLVMType(llvm::LLVMContext *ctx) const {
|
FunctionType::LLVMType(llvm::LLVMContext *ctx) const {
|
||||||
FATAL("FunctionType::LLVMType() shouldn't be called");
|
FATAL("FunctionType::LLVMType() shouldn't be called");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1565,12 +1565,12 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the LLVM Type *s for the function arguments
|
// Get the LLVM Type *s for the function arguments
|
||||||
std::vector<llvm::Type *> llvmArgTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> llvmArgTypes;
|
||||||
for (unsigned int i = 0; i < argTypes.size(); ++i) {
|
for (unsigned int i = 0; i < argTypes.size(); ++i) {
|
||||||
if (!argTypes[i])
|
if (!argTypes[i])
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
llvm::Type *t = argTypes[i]->LLVMType(ctx);
|
LLVM_TYPE_CONST llvm::Type *t = argTypes[i]->LLVMType(ctx);
|
||||||
if (!t)
|
if (!t)
|
||||||
return NULL;
|
return NULL;
|
||||||
llvmArgTypes.push_back(t);
|
llvmArgTypes.push_back(t);
|
||||||
@@ -1580,7 +1580,7 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
|
|||||||
if (includeMask)
|
if (includeMask)
|
||||||
llvmArgTypes.push_back(LLVMTypes::MaskType);
|
llvmArgTypes.push_back(LLVMTypes::MaskType);
|
||||||
|
|
||||||
std::vector<llvm::Type *> callTypes;
|
std::vector<LLVM_TYPE_CONST llvm::Type *> callTypes;
|
||||||
if (isTask) {
|
if (isTask) {
|
||||||
// Tasks take three arguments: a pointer to a struct that holds the
|
// Tasks take three arguments: a pointer to a struct that holds the
|
||||||
// actual task arguments, the thread index, and the total number of
|
// actual task arguments, the thread index, and the total number of
|
||||||
|
|||||||
16
type.h
16
type.h
@@ -133,7 +133,7 @@ public:
|
|||||||
virtual std::string GetCDeclaration(const std::string &name) const = 0;
|
virtual std::string GetCDeclaration(const std::string &name) const = 0;
|
||||||
|
|
||||||
/** Returns the LLVM type corresponding to this ispc type */
|
/** Returns the LLVM type corresponding to this ispc type */
|
||||||
virtual llvm::Type *LLVMType(llvm::LLVMContext *ctx) const = 0;
|
virtual LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const = 0;
|
||||||
|
|
||||||
/** Returns the DIType (LLVM's debugging information structure),
|
/** Returns the DIType (LLVM's debugging information structure),
|
||||||
corresponding to this type. */
|
corresponding to this type. */
|
||||||
@@ -202,7 +202,7 @@ public:
|
|||||||
std::string Mangle() const;
|
std::string Mangle() const;
|
||||||
std::string GetCDeclaration(const std::string &name) const;
|
std::string GetCDeclaration(const std::string &name) const;
|
||||||
|
|
||||||
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
/** This enumerant records the basic types that AtomicTypes can be
|
/** This enumerant records the basic types that AtomicTypes can be
|
||||||
@@ -323,7 +323,7 @@ public:
|
|||||||
std::string GetCDeclaration(const std::string &name) const;
|
std::string GetCDeclaration(const std::string &name) const;
|
||||||
|
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
|
|
||||||
/** This method returns the total number of elements in the array,
|
/** This method returns the total number of elements in the array,
|
||||||
including all dimensions if this is a multidimensional array. */
|
including all dimensions if this is a multidimensional array. */
|
||||||
@@ -392,7 +392,7 @@ public:
|
|||||||
|
|
||||||
int TotalElementCount() const;
|
int TotalElementCount() const;
|
||||||
|
|
||||||
llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::ArrayType *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
SOAArrayType *GetSizedArray(int size) const;
|
SOAArrayType *GetSizedArray(int size) const;
|
||||||
@@ -441,7 +441,7 @@ public:
|
|||||||
std::string Mangle() const;
|
std::string Mangle() const;
|
||||||
std::string GetCDeclaration(const std::string &name) const;
|
std::string GetCDeclaration(const std::string &name) const;
|
||||||
|
|
||||||
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
int GetElementCount() const;
|
int GetElementCount() const;
|
||||||
@@ -487,7 +487,7 @@ public:
|
|||||||
std::string Mangle() const;
|
std::string Mangle() const;
|
||||||
std::string GetCDeclaration(const std::string &name) const;
|
std::string GetCDeclaration(const std::string &name) const;
|
||||||
|
|
||||||
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
/** Returns the type of the structure element with the given name (if any).
|
/** Returns the type of the structure element with the given name (if any).
|
||||||
@@ -559,7 +559,7 @@ public:
|
|||||||
std::string Mangle() const;
|
std::string Mangle() const;
|
||||||
std::string GetCDeclaration(const std::string &name) const;
|
std::string GetCDeclaration(const std::string &name) const;
|
||||||
|
|
||||||
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -605,7 +605,7 @@ public:
|
|||||||
std::string Mangle() const;
|
std::string Mangle() const;
|
||||||
std::string GetCDeclaration(const std::string &fname) const;
|
std::string GetCDeclaration(const std::string &fname) const;
|
||||||
|
|
||||||
llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
LLVM_TYPE_CONST llvm::Type *LLVMType(llvm::LLVMContext *ctx) const;
|
||||||
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
llvm::DIType GetDIType(llvm::DIDescriptor scope) const;
|
||||||
|
|
||||||
const Type *GetReturnType() const { return returnType; }
|
const Type *GetReturnType() const { return returnType; }
|
||||||
|
|||||||
Reference in New Issue
Block a user