Many fixes for recent LLVM dev tree API changes
This commit is contained in:
@@ -476,7 +476,7 @@ lDefineConstantInt(const char *name, int val, llvm::Module *module,
|
||||
Symbol *pw = new Symbol(name, SourcePos(), AtomicType::UniformConstInt32);
|
||||
pw->isStatic = true;
|
||||
pw->constValue = new ConstExpr(pw->type, val, SourcePos());
|
||||
const llvm::Type *ltype = LLVMTypes::Int32Type;
|
||||
LLVM_TYPE_CONST llvm::Type *ltype = LLVMTypes::Int32Type;
|
||||
llvm::Constant *linit = LLVMInt32(val);
|
||||
pw->storagePtr = new llvm::GlobalVariable(*module, ltype, true,
|
||||
llvm::GlobalValue::InternalLinkage,
|
||||
@@ -496,7 +496,7 @@ lDefineProgramIndex(llvm::Module *module, SymbolTable *symbolTable) {
|
||||
pi[i] = i;
|
||||
pidx->constValue = new ConstExpr(pidx->type, pi, SourcePos());
|
||||
|
||||
const llvm::Type *ltype = LLVMTypes::Int32VectorType;
|
||||
LLVM_TYPE_CONST llvm::Type *ltype = LLVMTypes::Int32VectorType;
|
||||
llvm::Constant *linit = LLVMInt32Vector(pi);
|
||||
pidx->storagePtr = new llvm::GlobalVariable(*module, ltype, true,
|
||||
llvm::GlobalValue::InternalLinkage, linit,
|
||||
|
||||
161
ctx.cpp
161
ctx.cpp
@@ -147,7 +147,7 @@ FunctionEmitContext::FunctionEmitContext(const Type *rt, llvm::Function *functio
|
||||
if (!returnType || returnType == AtomicType::Void)
|
||||
returnValuePtr = NULL;
|
||||
else {
|
||||
const llvm::Type *ftype = returnType->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *ftype = returnType->LLVMType(g->ctx);
|
||||
returnValuePtr = AllocaInst(ftype, "return_value_memory");
|
||||
// FIXME: don't do this store???
|
||||
StoreInst(llvm::Constant::getNullValue(ftype), returnValuePtr);
|
||||
@@ -735,11 +735,12 @@ FunctionEmitContext::CreateBasicBlock(const char *name) {
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::I1VecToBoolVec(llvm::Value *b) {
|
||||
const llvm::ArrayType *at = llvm::dyn_cast<const llvm::ArrayType>(b->getType());
|
||||
LLVM_TYPE_CONST llvm::ArrayType *at =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(b->getType());
|
||||
if (at) {
|
||||
// If we're given an array of vectors of i1s, then do the
|
||||
// conversion for each of the elements
|
||||
const llvm::Type *boolArrayType =
|
||||
LLVM_TYPE_CONST llvm::Type *boolArrayType =
|
||||
llvm::ArrayType::get(LLVMTypes::BoolVectorType, at->getNumElements());
|
||||
llvm::Value *ret = llvm::UndefValue::get(boolArrayType);
|
||||
|
||||
@@ -757,11 +758,11 @@ FunctionEmitContext::I1VecToBoolVec(llvm::Value *b) {
|
||||
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::EmitMalloc(const llvm::Type *ty, int align) {
|
||||
FunctionEmitContext::EmitMalloc(LLVM_TYPE_CONST llvm::Type *ty, int align) {
|
||||
// Emit code to compute the size of the given type using a GEP with a
|
||||
// NULL base pointer, indexing one element of the given type, and
|
||||
// casting the resulting 'pointer' to an int giving its size.
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(ty, 0);
|
||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(ty, 0);
|
||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||
llvm::Value *index[1] = { LLVMInt32(1) };
|
||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, &index[0], &index[1],
|
||||
@@ -941,15 +942,16 @@ FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym) {
|
||||
Otherwise return zero.
|
||||
*/
|
||||
static int
|
||||
lArrayVectorWidth(const llvm::Type *t) {
|
||||
const llvm::ArrayType *arrayType = llvm::dyn_cast<const llvm::ArrayType>(t);
|
||||
lArrayVectorWidth(LLVM_TYPE_CONST llvm::Type *t) {
|
||||
LLVM_TYPE_CONST llvm::ArrayType *arrayType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(t);
|
||||
if (arrayType == NULL)
|
||||
return 0;
|
||||
|
||||
// We shouldn't be seeing arrays of anything but vectors being passed
|
||||
// to things like FunctionEmitContext::BinaryOperator() as operands
|
||||
const llvm::VectorType *vectorElementType =
|
||||
llvm::dyn_cast<const llvm::VectorType>(arrayType->getElementType());
|
||||
LLVM_TYPE_CONST llvm::VectorType *vectorElementType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(arrayType->getElementType());
|
||||
assert(vectorElementType != NULL &&
|
||||
(int)vectorElementType->getNumElements() == g->target.vectorWidth);
|
||||
return (int)arrayType->getNumElements();
|
||||
@@ -966,7 +968,7 @@ FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps inst,
|
||||
}
|
||||
|
||||
assert(v0->getType() == v1->getType());
|
||||
const llvm::Type *type = v0->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *type = v0->getType();
|
||||
int arraySize = lArrayVectorWidth(type);
|
||||
if (arraySize == 0) {
|
||||
llvm::Instruction *bop =
|
||||
@@ -1000,7 +1002,7 @@ FunctionEmitContext::NotOperator(llvm::Value *v, const char *name) {
|
||||
// Similarly to BinaryOperator, do the operation on all the elements of
|
||||
// the array if we're given an array type; otherwise just do the
|
||||
// regular llvm operation.
|
||||
const llvm::Type *type = v->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *type = v->getType();
|
||||
int arraySize = lArrayVectorWidth(type);
|
||||
if (arraySize == 0) {
|
||||
llvm::Instruction *binst =
|
||||
@@ -1025,20 +1027,20 @@ FunctionEmitContext::NotOperator(llvm::Value *v, const char *name) {
|
||||
// Given the llvm Type that represents an ispc VectorType, return an
|
||||
// equally-shaped type with boolean elements. (This is the type that will
|
||||
// be returned from CmpInst with ispc VectorTypes).
|
||||
static const llvm::Type *
|
||||
lGetMatchingBoolVectorType(const llvm::Type *type) {
|
||||
const llvm::ArrayType *arrayType =
|
||||
llvm::dyn_cast<const llvm::ArrayType>(type);
|
||||
static LLVM_TYPE_CONST llvm::Type *
|
||||
lGetMatchingBoolVectorType(LLVM_TYPE_CONST llvm::Type *type) {
|
||||
LLVM_TYPE_CONST llvm::ArrayType *arrayType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(type);
|
||||
// should only be called for vector typed stuff...
|
||||
assert(arrayType != NULL);
|
||||
|
||||
const llvm::VectorType *vectorElementType =
|
||||
llvm::dyn_cast<const llvm::VectorType>(arrayType->getElementType());
|
||||
LLVM_TYPE_CONST llvm::VectorType *vectorElementType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(arrayType->getElementType());
|
||||
assert(vectorElementType != NULL &&
|
||||
(int)vectorElementType->getNumElements() == g->target.vectorWidth);
|
||||
|
||||
const llvm::Type *base = llvm::VectorType::get(LLVMTypes::BoolType,
|
||||
g->target.vectorWidth);
|
||||
LLVM_TYPE_CONST llvm::Type *base =
|
||||
llvm::VectorType::get(LLVMTypes::BoolType, g->target.vectorWidth);
|
||||
return llvm::ArrayType::get(base, arrayType->getNumElements());
|
||||
}
|
||||
|
||||
@@ -1054,7 +1056,7 @@ FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst,
|
||||
}
|
||||
|
||||
assert(v0->getType() == v1->getType());
|
||||
const llvm::Type *type = v0->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *type = v0->getType();
|
||||
int arraySize = lArrayVectorWidth(type);
|
||||
if (arraySize == 0) {
|
||||
llvm::Instruction *ci =
|
||||
@@ -1064,7 +1066,7 @@ FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst,
|
||||
return ci;
|
||||
}
|
||||
else {
|
||||
const llvm::Type *boolType = lGetMatchingBoolVectorType(type);
|
||||
LLVM_TYPE_CONST llvm::Type *boolType = lGetMatchingBoolVectorType(type);
|
||||
llvm::Value *ret = llvm::UndefValue::get(boolType);
|
||||
for (int i = 0; i < arraySize; ++i) {
|
||||
llvm::Value *a = ExtractInst(v0, i);
|
||||
@@ -1078,16 +1080,17 @@ FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst,
|
||||
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::BitCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::BitCastInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const llvm::Type *valType = value->getType();
|
||||
const llvm::ArrayType *at = llvm::dyn_cast<const llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<const llvm::PointerType>(at->getElementType())) {
|
||||
LLVM_TYPE_CONST llvm::Type *valType = value->getType();
|
||||
LLVM_TYPE_CONST llvm::ArrayType *at =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(at->getElementType())) {
|
||||
// If we're bitcasting an array of pointers, we have a varying
|
||||
// lvalue; apply the corresponding bitcast to each of the
|
||||
// individual pointers and return the result array.
|
||||
@@ -1112,16 +1115,17 @@ FunctionEmitContext::BitCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::PtrToIntInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::PtrToIntInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const llvm::Type *valType = value->getType();
|
||||
const llvm::ArrayType *at = llvm::dyn_cast<const llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<const llvm::PointerType>(at->getElementType())) {
|
||||
LLVM_TYPE_CONST llvm::Type *valType = value->getType();
|
||||
LLVM_TYPE_CONST llvm::ArrayType *at =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(at->getElementType())) {
|
||||
// varying lvalue -> apply ptr to int to the individual pointers
|
||||
assert((int)at->getNumElements() == g->target.vectorWidth);
|
||||
|
||||
@@ -1144,16 +1148,17 @@ FunctionEmitContext::PtrToIntInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::IntToPtrInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::IntToPtrInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const llvm::Type *valType = value->getType();
|
||||
const llvm::ArrayType *at = llvm::dyn_cast<const llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<const llvm::PointerType>(at->getElementType())) {
|
||||
LLVM_TYPE_CONST llvm::Type *valType = value->getType();
|
||||
LLVM_TYPE_CONST llvm::ArrayType *at =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(valType);
|
||||
if (at && llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(at->getElementType())) {
|
||||
// varying lvalue -> apply int to ptr to the individual pointers
|
||||
assert((int)at->getNumElements() == g->target.vectorWidth);
|
||||
|
||||
@@ -1176,7 +1181,7 @@ FunctionEmitContext::IntToPtrInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
|
||||
llvm::Instruction *
|
||||
FunctionEmitContext::TruncInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::TruncInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
@@ -1194,7 +1199,7 @@ FunctionEmitContext::TruncInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
llvm::Instruction *
|
||||
FunctionEmitContext::CastInst(llvm::Instruction::CastOps op, llvm::Value *value,
|
||||
const llvm::Type *type, const char *name) {
|
||||
LLVM_TYPE_CONST llvm::Type *type, const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
return NULL;
|
||||
@@ -1210,7 +1215,7 @@ FunctionEmitContext::CastInst(llvm::Instruction::CastOps op, llvm::Value *value,
|
||||
|
||||
|
||||
llvm::Instruction *
|
||||
FunctionEmitContext::FPCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::FPCastInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
@@ -1227,7 +1232,7 @@ FunctionEmitContext::FPCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
|
||||
llvm::Instruction *
|
||||
FunctionEmitContext::SExtInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::SExtInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
@@ -1244,7 +1249,7 @@ FunctionEmitContext::SExtInst(llvm::Value *value, const llvm::Type *type,
|
||||
|
||||
|
||||
llvm::Instruction *
|
||||
FunctionEmitContext::ZExtInst(llvm::Value *value, const llvm::Type *type,
|
||||
FunctionEmitContext::ZExtInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name) {
|
||||
if (value == NULL) {
|
||||
assert(m->errorCount > 0);
|
||||
@@ -1270,14 +1275,15 @@ FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0
|
||||
|
||||
// FIXME: do we need need to handle the case of the first index being
|
||||
// varying? It's currently needed...
|
||||
assert(!llvm::isa<const llvm::VectorType>(index0->getType()));
|
||||
assert(!llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(index0->getType()));
|
||||
|
||||
const llvm::Type *basePtrType = basePtr->getType();
|
||||
const llvm::ArrayType *baseArrayType =
|
||||
llvm::dyn_cast<const llvm::ArrayType>(basePtrType);
|
||||
LLVM_TYPE_CONST llvm::Type *basePtrType = basePtr->getType();
|
||||
LLVM_TYPE_CONST llvm::ArrayType *baseArrayType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(basePtrType);
|
||||
bool baseIsVaryingTypePointer = (baseArrayType != NULL) &&
|
||||
llvm::isa<const llvm::PointerType>(baseArrayType->getElementType());
|
||||
bool indexIsVaryingType = llvm::isa<const llvm::VectorType>(index1->getType());
|
||||
llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(baseArrayType->getElementType());
|
||||
bool indexIsVaryingType =
|
||||
llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(index1->getType());
|
||||
|
||||
if (!indexIsVaryingType && !baseIsVaryingTypePointer) {
|
||||
// The easy case: both the base pointer and the indices are
|
||||
@@ -1316,9 +1322,10 @@ FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0
|
||||
// This is kind of a hack: use the type from the GEP to
|
||||
// figure out the return type and the first time through,
|
||||
// create an undef value of that type here
|
||||
const llvm::PointerType *elementPtrType =
|
||||
llvm::dyn_cast<const llvm::PointerType>(eltPtr->getType());
|
||||
const llvm::Type *elementType = elementPtrType->getElementType();
|
||||
LLVM_TYPE_CONST llvm::PointerType *elementPtrType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::PointerType>(eltPtr->getType());
|
||||
LLVM_TYPE_CONST llvm::Type *elementType =
|
||||
elementPtrType->getElementType();
|
||||
lret = llvm::UndefValue::get(LLVMPointerVectorType(elementType));
|
||||
}
|
||||
|
||||
@@ -1345,7 +1352,7 @@ FunctionEmitContext::LoadInst(llvm::Value *lvalue, const Type *type,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (llvm::isa<const llvm::PointerType>(lvalue->getType())) {
|
||||
if (llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(lvalue->getType())) {
|
||||
// If the lvalue is a straight up regular pointer, then just issue
|
||||
// a regular load. First figure out the alignment; in general we
|
||||
// can just assume the natural alignment (0 here), but for varying
|
||||
@@ -1372,7 +1379,7 @@ FunctionEmitContext::LoadInst(llvm::Value *lvalue, const Type *type,
|
||||
// information we need from the LLVM::Type, so have to carry the
|
||||
// ispc type in through this path..
|
||||
assert(type != NULL);
|
||||
assert(llvm::isa<const llvm::ArrayType>(lvalue->getType()));
|
||||
assert(llvm::isa<LLVM_TYPE_CONST llvm::ArrayType>(lvalue->getType()));
|
||||
return gather(lvalue, type, name);
|
||||
}
|
||||
}
|
||||
@@ -1382,9 +1389,9 @@ llvm::Value *
|
||||
FunctionEmitContext::gather(llvm::Value *lvalue, const Type *type,
|
||||
const char *name) {
|
||||
// We should have a varying lvalue if we get here...
|
||||
assert(llvm::dyn_cast<const llvm::ArrayType>(lvalue->getType()));
|
||||
assert(llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(lvalue->getType()));
|
||||
|
||||
const llvm::Type *retType = type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *retType = type->LLVMType(g->ctx);
|
||||
|
||||
const StructType *st = dynamic_cast<const StructType *>(type);
|
||||
if (st) {
|
||||
@@ -1410,7 +1417,7 @@ FunctionEmitContext::gather(llvm::Value *lvalue, const Type *type,
|
||||
// the GEP stuff in the loop below ends up computing pointers based
|
||||
// on elements in the vectors rather than incorrectly advancing to
|
||||
// the next vector...
|
||||
const llvm::Type *eltType =
|
||||
LLVM_TYPE_CONST llvm::Type *eltType =
|
||||
vt->GetBaseType()->GetAsUniformType()->LLVMType(g->ctx);
|
||||
lvalue = BitCastInst(lvalue, llvm::PointerType::get(llvm::ArrayType::get(eltType, 0), 0));
|
||||
|
||||
@@ -1499,7 +1506,7 @@ FunctionEmitContext::addGSMetadata(llvm::Instruction *inst, SourcePos pos) {
|
||||
|
||||
|
||||
llvm::Value *
|
||||
FunctionEmitContext::AllocaInst(const llvm::Type *llvmType, const char *name,
|
||||
FunctionEmitContext::AllocaInst(LLVM_TYPE_CONST llvm::Type *llvmType, const char *name,
|
||||
int align, bool atEntryBlock) {
|
||||
llvm::AllocaInst *inst = NULL;
|
||||
if (atEntryBlock) {
|
||||
@@ -1519,9 +1526,10 @@ FunctionEmitContext::AllocaInst(const llvm::Type *llvmType, const char *name,
|
||||
// unlikely that this array will be loaded into varying variables with
|
||||
// what will be aligned accesses if the uniform -> varying load is done
|
||||
// in regular chunks.
|
||||
const llvm::ArrayType *arrayType = llvm::dyn_cast<const llvm::ArrayType>(llvmType);
|
||||
LLVM_TYPE_CONST llvm::ArrayType *arrayType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(llvmType);
|
||||
if (align == 0 && arrayType != NULL &&
|
||||
!llvm::isa<const llvm::VectorType>(arrayType->getElementType()))
|
||||
!llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(arrayType->getElementType()))
|
||||
align = 4 * g->target.nativeVectorWidth;
|
||||
|
||||
if (align != 0)
|
||||
@@ -1546,7 +1554,7 @@ FunctionEmitContext::maskedStore(llvm::Value *rvalue, llvm::Value *lvalue,
|
||||
return;
|
||||
}
|
||||
|
||||
assert(llvm::isa<const llvm::PointerType>(lvalue->getType()));
|
||||
assert(llvm::isa<LLVM_TYPE_CONST llvm::PointerType>(lvalue->getType()));
|
||||
|
||||
const CollectionType *collectionType =
|
||||
dynamic_cast<const CollectionType *>(rvalueType);
|
||||
@@ -1616,7 +1624,7 @@ void
|
||||
FunctionEmitContext::scatter(llvm::Value *rvalue, llvm::Value *lvalue,
|
||||
llvm::Value *storeMask, const Type *rvalueType) {
|
||||
assert(rvalueType->IsVaryingType());
|
||||
assert(llvm::isa<const llvm::ArrayType>(lvalue->getType()));
|
||||
assert(llvm::isa<LLVM_TYPE_CONST llvm::ArrayType>(lvalue->getType()));
|
||||
|
||||
const StructType *structType = dynamic_cast<const StructType *>(rvalueType);
|
||||
if (structType) {
|
||||
@@ -1635,7 +1643,8 @@ FunctionEmitContext::scatter(llvm::Value *rvalue, llvm::Value *lvalue,
|
||||
// the GEP stuff in the loop below ends up computing pointers based
|
||||
// on elements in the vectors rather than incorrectly advancing to
|
||||
// the next vector...
|
||||
const llvm::Type *eltType = vt->GetBaseType()->GetAsUniformType()->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *eltType =
|
||||
vt->GetBaseType()->GetAsUniformType()->LLVMType(g->ctx);
|
||||
lvalue = BitCastInst(lvalue, llvm::PointerType::get(llvm::ArrayType::get(eltType, 0), 0));
|
||||
|
||||
for (int i = 0; i < vt->GetElementCount(); ++i) {
|
||||
@@ -1653,7 +1662,7 @@ FunctionEmitContext::scatter(llvm::Value *rvalue, llvm::Value *lvalue,
|
||||
assert(dynamic_cast<const AtomicType *>(rvalueType) != NULL);
|
||||
|
||||
llvm::Function *func = NULL;
|
||||
const llvm::Type *type = rvalue->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *type = rvalue->getType();
|
||||
if (type == LLVMTypes::DoubleVectorType ||
|
||||
type == LLVMTypes::Int64VectorType) {
|
||||
func = m->module->getFunction("__pseudo_scatter_64");
|
||||
@@ -1720,7 +1729,7 @@ FunctionEmitContext::StoreInst(llvm::Value *rvalue, llvm::Value *lvalue,
|
||||
llvm::Instruction *si = new llvm::StoreInst(rvalue, lvalue, bblock);
|
||||
AddDebugPos(si);
|
||||
}
|
||||
else if (llvm::isa<const llvm::ArrayType>(lvalue->getType()))
|
||||
else if (llvm::isa<LLVM_TYPE_CONST llvm::ArrayType>(lvalue->getType()))
|
||||
// We have a varying lvalue (an array of pointers), so it's time to
|
||||
// scatter
|
||||
scatter(rvalue, lvalue, storeMask, rvalueType);
|
||||
@@ -1764,7 +1773,7 @@ FunctionEmitContext::ExtractInst(llvm::Value *v, int elt, const char *name) {
|
||||
}
|
||||
|
||||
llvm::Instruction *ei = NULL;
|
||||
if (llvm::isa<const llvm::VectorType>(v->getType()))
|
||||
if (llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(v->getType()))
|
||||
ei = llvm::ExtractElementInst::Create(v, LLVMInt32(elt),
|
||||
name ? name : "extract", bblock);
|
||||
else
|
||||
@@ -1784,7 +1793,7 @@ FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt,
|
||||
}
|
||||
|
||||
llvm::Instruction *ii = NULL;
|
||||
if (llvm::isa<const llvm::VectorType>(v->getType()))
|
||||
if (llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(v->getType()))
|
||||
ii = llvm::InsertElementInst::Create(v, eltVal, LLVMInt32(elt),
|
||||
name ? name : "insert", bblock);
|
||||
else
|
||||
@@ -1796,7 +1805,7 @@ FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt,
|
||||
|
||||
|
||||
llvm::PHINode *
|
||||
FunctionEmitContext::PhiNode(const llvm::Type *type, int count,
|
||||
FunctionEmitContext::PhiNode(LLVM_TYPE_CONST llvm::Type *type, int count,
|
||||
const char *name) {
|
||||
llvm::PHINode *pn = llvm::PHINode::Create(type,
|
||||
#if !defined(LLVM_2_8) && !defined(LLVM_2_9)
|
||||
@@ -1833,9 +1842,14 @@ FunctionEmitContext::CallInst(llvm::Function *func,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, args, name ? name : "", bblock);
|
||||
#else
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, args.begin(), args.end(),
|
||||
name ? name : "", bblock);
|
||||
#endif
|
||||
AddDebugPos(ci);
|
||||
return ci;
|
||||
}
|
||||
@@ -1849,10 +1863,15 @@ FunctionEmitContext::CallInst(llvm::Function *func, llvm::Value *arg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, arg, name ? name : "", bblock);
|
||||
#else
|
||||
llvm::Value *args[] = { arg };
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, &args[0], &args[1], name ? name : "",
|
||||
bblock);
|
||||
#endif
|
||||
AddDebugPos(ci);
|
||||
return ci;
|
||||
}
|
||||
@@ -1867,9 +1886,16 @@ FunctionEmitContext::CallInst(llvm::Function *func, llvm::Value *arg0,
|
||||
}
|
||||
|
||||
llvm::Value *args[] = { arg0, arg1 };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> argArrayRef(&args[0], &args[2]);
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, argArrayRef, name ? name : "",
|
||||
bblock);
|
||||
#else
|
||||
llvm::Instruction *ci =
|
||||
llvm::CallInst::Create(func, &args[0], &args[2], name ? name : "",
|
||||
bblock);
|
||||
#endif
|
||||
AddDebugPos(ci);
|
||||
return ci;
|
||||
}
|
||||
@@ -1916,12 +1942,13 @@ FunctionEmitContext::LaunchInst(llvm::Function *callee,
|
||||
|
||||
launchedTasks = true;
|
||||
|
||||
const llvm::Type *argType = callee->arg_begin()->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *argType = callee->arg_begin()->getType();
|
||||
assert(llvm::PointerType::classof(argType));
|
||||
const llvm::PointerType *pt = static_cast<const llvm::PointerType *>(argType);
|
||||
LLVM_TYPE_CONST llvm::PointerType *pt =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::PointerType>(argType);
|
||||
assert(llvm::StructType::classof(pt->getElementType()));
|
||||
const llvm::StructType *argStructType =
|
||||
static_cast<const llvm::StructType *>(pt->getElementType());
|
||||
LLVM_TYPE_CONST llvm::StructType *argStructType =
|
||||
static_cast<LLVM_TYPE_CONST llvm::StructType *>(pt->getElementType());
|
||||
assert(argStructType->getNumElements() == argVals.size() + 1);
|
||||
|
||||
int align = 4 * RoundUpPow2(g->target.nativeVectorWidth);
|
||||
|
||||
23
ctx.h
23
ctx.h
@@ -213,7 +213,7 @@ public:
|
||||
/** Emit code to call the user-supplied ISPCMalloc function to
|
||||
allocate space for an object of thee given type. Returns the
|
||||
pointer value returned by the ISPCMalloc call. */
|
||||
llvm::Value *EmitMalloc(const llvm::Type *ty, int align = 0);
|
||||
llvm::Value *EmitMalloc(LLVM_TYPE_CONST llvm::Type *ty, int align = 0);
|
||||
|
||||
/** Emit code to call the user-supplied ISPCFree function, passing it
|
||||
the given pointer to storage previously allocated by an
|
||||
@@ -303,21 +303,21 @@ public:
|
||||
llvm::CmpInst::Predicate pred,
|
||||
llvm::Value *v0, llvm::Value *v1, const char *name = NULL);
|
||||
|
||||
llvm::Value *BitCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Value *BitCastInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Value *PtrToIntInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Value *PtrToIntInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Value *IntToPtrInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Value *IntToPtrInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Instruction *TruncInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Instruction *TruncInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Instruction *CastInst(llvm::Instruction::CastOps op, llvm::Value *value,
|
||||
const llvm::Type *type, const char *name = NULL);
|
||||
llvm::Instruction *FPCastInst(llvm::Value *value, const llvm::Type *type,
|
||||
LLVM_TYPE_CONST llvm::Type *type, const char *name = NULL);
|
||||
llvm::Instruction *FPCastInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Instruction *SExtInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Instruction *SExtInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
llvm::Instruction *ZExtInst(llvm::Value *value, const llvm::Type *type,
|
||||
llvm::Instruction *ZExtInst(llvm::Value *value, LLVM_TYPE_CONST llvm::Type *type,
|
||||
const char *name = NULL);
|
||||
|
||||
/** This GEP method is a generalization of the standard one in LLVM; it
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
instruction is added at the start of the function in the entry
|
||||
basic block; if it should be added to the current basic block, then
|
||||
the atEntryBlock parameter should be false. */
|
||||
llvm::Value *AllocaInst(const llvm::Type *llvmType, const char *name = NULL,
|
||||
llvm::Value *AllocaInst(LLVM_TYPE_CONST llvm::Type *llvmType, const char *name = NULL,
|
||||
int align = 0, bool atEntryBlock = true);
|
||||
|
||||
/** Standard store instruction; for this variant, the lvalue must be a
|
||||
@@ -378,7 +378,8 @@ public:
|
||||
llvm::Value *InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt,
|
||||
const char *name = NULL);
|
||||
|
||||
llvm::PHINode *PhiNode(const llvm::Type *type, int count, const char *name = NULL);
|
||||
llvm::PHINode *PhiNode(LLVM_TYPE_CONST llvm::Type *type, int count,
|
||||
const char *name = NULL);
|
||||
llvm::Instruction *SelectInst(llvm::Value *test, llvm::Value *val0,
|
||||
llvm::Value *val1, const char *name = NULL);
|
||||
|
||||
|
||||
51
expr.cpp
51
expr.cpp
@@ -397,7 +397,7 @@ lLLVMConstantValue(const Type *type, llvm::LLVMContext *ctx, double value) {
|
||||
// a recursive call to lLLVMConstantValue().
|
||||
const Type *baseType = vectorType->GetBaseType();
|
||||
llvm::Constant *constElement = lLLVMConstantValue(baseType, ctx, value);
|
||||
const llvm::Type *llvmVectorType = vectorType->LLVMType(ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *llvmVectorType = vectorType->LLVMType(ctx);
|
||||
|
||||
// Now create a constant version of the corresponding LLVM type that we
|
||||
// use to represent the VectorType.
|
||||
@@ -406,8 +406,8 @@ lLLVMConstantValue(const Type *type, llvm::LLVMContext *ctx, double value) {
|
||||
// LLVM ArrayTypes leaks into the code here; it feels like this detail
|
||||
// should be better encapsulated?
|
||||
if (baseType->IsUniformType()) {
|
||||
const llvm::VectorType *lvt =
|
||||
llvm::dyn_cast<const llvm::VectorType>(llvmVectorType);
|
||||
LLVM_TYPE_CONST llvm::VectorType *lvt =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(llvmVectorType);
|
||||
assert(lvt != NULL);
|
||||
std::vector<llvm::Constant *> vals;
|
||||
for (unsigned int i = 0; i < lvt->getNumElements(); ++i)
|
||||
@@ -415,8 +415,8 @@ lLLVMConstantValue(const Type *type, llvm::LLVMContext *ctx, double value) {
|
||||
return llvm::ConstantVector::get(vals);
|
||||
}
|
||||
else {
|
||||
const llvm::ArrayType *lat =
|
||||
llvm::dyn_cast<const llvm::ArrayType>(llvmVectorType);
|
||||
LLVM_TYPE_CONST llvm::ArrayType *lat =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(llvmVectorType);
|
||||
assert(lat != NULL);
|
||||
std::vector<llvm::Constant *> vals;
|
||||
for (unsigned int i = 0; i < lat->getNumElements(); ++i)
|
||||
@@ -2419,7 +2419,7 @@ FunctionCallExpr::GetValue(FunctionEmitContext *ctx) const {
|
||||
// The return value for the non-void case is either undefined or the
|
||||
// function return value, depending on whether we actually ran the code
|
||||
// path that called the function or not.
|
||||
const llvm::Type *lrType = ft->GetReturnType()->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *lrType = ft->GetReturnType()->LLVMType(g->ctx);
|
||||
llvm::PHINode *ret = ctx->PhiNode(lrType, 2, "fun_ret");
|
||||
assert(retVal != NULL);
|
||||
ret->addIncoming(llvm::UndefValue::get(lrType), bSkip);
|
||||
@@ -2576,15 +2576,16 @@ ExprList::GetConstant(const Type *type) const {
|
||||
#if defined(LLVM_2_8) || defined(LLVM_2_9)
|
||||
return llvm::ConstantStruct::get(*g->ctx, cv, false);
|
||||
#else
|
||||
const llvm::StructType *llvmStructType =
|
||||
llvm::dyn_cast<const llvm::StructType>(collectionType->LLVMType(g->ctx));
|
||||
LLVM_TYPE_CONST llvm::StructType *llvmStructType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::StructType>(collectionType->LLVMType(g->ctx));
|
||||
assert(llvmStructType != NULL);
|
||||
return llvm::ConstantStruct::get(llvmStructType, cv);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
const llvm::Type *lt = type->LLVMType(g->ctx);
|
||||
const llvm::ArrayType *lat = llvm::dyn_cast<const llvm::ArrayType>(lt);
|
||||
LLVM_TYPE_CONST llvm::Type *lt = type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::ArrayType *lat =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(lt);
|
||||
// FIXME: should the assert below validly fail for uniform vectors
|
||||
// now? Need a test case to reproduce it and then to be sure we
|
||||
// have the right fix; leave the assert until we can hit it...
|
||||
@@ -2625,19 +2626,19 @@ IndexExpr::IndexExpr(Expr *a, Expr *i, SourcePos p)
|
||||
|
||||
static llvm::Value *
|
||||
lCastUniformVectorBasePtr(llvm::Value *ptr, FunctionEmitContext *ctx) {
|
||||
const llvm::PointerType *baseType =
|
||||
llvm::dyn_cast<const llvm::PointerType>(ptr->getType());
|
||||
LLVM_TYPE_CONST llvm::PointerType *baseType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::PointerType>(ptr->getType());
|
||||
if (!baseType)
|
||||
return ptr;
|
||||
|
||||
const llvm::VectorType *baseEltVecType =
|
||||
llvm::dyn_cast<const llvm::VectorType>(baseType->getElementType());
|
||||
LLVM_TYPE_CONST llvm::VectorType *baseEltVecType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(baseType->getElementType());
|
||||
if (!baseEltVecType)
|
||||
return ptr;
|
||||
|
||||
const llvm::Type *vecEltType = baseEltVecType->getElementType();
|
||||
LLVM_TYPE_CONST llvm::Type *vecEltType = baseEltVecType->getElementType();
|
||||
int numElts = baseEltVecType->getNumElements();
|
||||
const llvm::Type *castType =
|
||||
LLVM_TYPE_CONST llvm::Type *castType =
|
||||
llvm::PointerType::get(llvm::ArrayType::get(vecEltType, numElts), 0);
|
||||
return ctx->BitCastInst(ptr, castType);
|
||||
}
|
||||
@@ -3622,7 +3623,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
|
||||
switch (toType->basicType) {
|
||||
case AtomicType::TYPE_FLOAT: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::FloatType :
|
||||
LLVMTypes::FloatVectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3662,7 +3663,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
break;
|
||||
}
|
||||
case AtomicType::TYPE_DOUBLE: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::DoubleType :
|
||||
LLVMTypes::DoubleVectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3699,7 +3700,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
break;
|
||||
}
|
||||
case AtomicType::TYPE_INT32: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::Int32Type :
|
||||
LLVMTypes::Int32VectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3731,7 +3732,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
break;
|
||||
}
|
||||
case AtomicType::TYPE_UINT32: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::Int32Type :
|
||||
LLVMTypes::Int32VectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3769,7 +3770,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
break;
|
||||
}
|
||||
case AtomicType::TYPE_INT64: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::Int64Type :
|
||||
LLVMTypes::Int64VectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3803,7 +3804,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
break;
|
||||
}
|
||||
case AtomicType::TYPE_UINT64: {
|
||||
const llvm::Type *targetType =
|
||||
LLVM_TYPE_CONST llvm::Type *targetType =
|
||||
fromType->IsUniformType() ? LLVMTypes::Int64Type :
|
||||
LLVMTypes::Int64VectorType;
|
||||
switch (fromType->basicType) {
|
||||
@@ -3904,7 +3905,7 @@ lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprVal,
|
||||
// If we also want to go from uniform to varying, replicate out the
|
||||
// value across the vector elements..
|
||||
if (toType->IsVaryingType() && fromType->IsUniformType()) {
|
||||
const llvm::Type *vtype = toType->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *vtype = toType->LLVMType(g->ctx);
|
||||
llvm::Value *castVec = llvm::UndefValue::get(vtype);
|
||||
for (int i = 0; i < g->target.vectorWidth; ++i)
|
||||
castVec = ctx->InsertInst(castVec, cast, i, "smearinsert");
|
||||
@@ -3925,7 +3926,7 @@ lUniformValueToVarying(FunctionEmitContext *ctx, llvm::Value *value,
|
||||
if (type->IsVaryingType())
|
||||
return value;
|
||||
|
||||
const llvm::Type *llvmType = type->GetAsVaryingType()->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *llvmType = type->GetAsVaryingType()->LLVMType(g->ctx);
|
||||
llvm::Value *retValue = llvm::UndefValue::get(llvmType);
|
||||
|
||||
// for structs/arrays/vectors, just recursively make their elements
|
||||
@@ -3989,7 +3990,7 @@ TypeCastExpr::GetValue(FunctionEmitContext *ctx) const {
|
||||
assert(Type::Equal(toArray->GetBaseType()->GetAsConstType(),
|
||||
fromArray->GetBaseType()->GetAsConstType()));
|
||||
llvm::Value *v = expr->GetValue(ctx);
|
||||
const llvm::Type *ptype = toType->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *ptype = toType->LLVMType(g->ctx);
|
||||
return ctx->BitCastInst(v, ptype); //, "array_cast_0size");
|
||||
}
|
||||
|
||||
|
||||
@@ -325,8 +325,8 @@ LLVMBoolVector(const bool *bvec) {
|
||||
}
|
||||
|
||||
|
||||
const llvm::ArrayType *
|
||||
LLVMPointerVectorType(const llvm::Type *t) {
|
||||
LLVM_TYPE_CONST llvm::ArrayType *
|
||||
LLVMPointerVectorType(LLVM_TYPE_CONST llvm::Type *t) {
|
||||
// NOTE: ArrayType, not VectorType
|
||||
return llvm::ArrayType::get(llvm::PointerType::get(t, 0),
|
||||
g->target.vectorWidth);
|
||||
|
||||
@@ -155,6 +155,6 @@ extern llvm::Constant *LLVMMaskAllOff;
|
||||
pointers to that type. (In practice, an array of pointers, since LLVM
|
||||
prohibits vectors of pointers.
|
||||
*/
|
||||
extern const llvm::ArrayType *LLVMPointerVectorType(const llvm::Type *t);
|
||||
extern LLVM_TYPE_CONST llvm::ArrayType *LLVMPointerVectorType(LLVM_TYPE_CONST llvm::Type *t);
|
||||
|
||||
#endif // ISPC_LLVMUTIL_H
|
||||
|
||||
@@ -317,7 +317,7 @@ lInitFunSymDecl(DeclSpecs *ds, Declarator *decl) {
|
||||
|
||||
// Get the LLVM FunctionType
|
||||
bool includeMask = (ds->storageClass != SC_EXTERN_C);
|
||||
const llvm::FunctionType *llvmFunctionType =
|
||||
LLVM_TYPE_CONST llvm::FunctionType *llvmFunctionType =
|
||||
functionType->LLVMFunctionType(g->ctx, includeMask);
|
||||
if (llvmFunctionType == NULL)
|
||||
return false;
|
||||
@@ -486,7 +486,7 @@ Module::AddGlobal(DeclSpecs *ds, Declarator *decl) {
|
||||
return;
|
||||
}
|
||||
|
||||
const llvm::Type *llvmType = decl->sym->type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *llvmType = decl->sym->type->LLVMType(g->ctx);
|
||||
llvm::GlobalValue::LinkageTypes linkage =
|
||||
(ds->storageClass == SC_STATIC) ? llvm::GlobalValue::InternalLinkage :
|
||||
llvm::GlobalValue::ExternalLinkage;
|
||||
@@ -576,7 +576,7 @@ lCopyInTaskParameter(int i, llvm::Value *structArgPtr, Declarator *decl,
|
||||
llvm::dyn_cast<const llvm::StructType>(pt->getElementType());
|
||||
|
||||
// Get the type of the argument we're copying in and its Symbol pointer
|
||||
const llvm::Type *argType = argStructType->getElementType(i);
|
||||
LLVM_TYPE_CONST llvm::Type *argType = argStructType->getElementType(i);
|
||||
Declaration *pdecl = (*decl->functionArgs)[i];
|
||||
assert(pdecl->declarators.size() == 1);
|
||||
Symbol *sym = pdecl->declarators[0]->sym;
|
||||
@@ -796,7 +796,8 @@ Module::AddFunction(DeclSpecs *ds, Declarator *decl, Stmt *code) {
|
||||
// the application can call it
|
||||
if (ds->storageClass == SC_EXPORT) {
|
||||
if (!functionType->isTask) {
|
||||
const llvm::FunctionType *ftype = functionType->LLVMFunctionType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::FunctionType *ftype =
|
||||
functionType->LLVMFunctionType(g->ctx);
|
||||
llvm::GlobalValue::LinkageTypes linkage = llvm::GlobalValue::ExternalLinkage;
|
||||
llvm::Function *appFunction =
|
||||
llvm::Function::Create(ftype, linkage, funSym->name.c_str(), module);
|
||||
|
||||
114
opt.cpp
114
opt.cpp
@@ -692,7 +692,7 @@ lSizeOfIfKnown(const llvm::Type *type, uint64_t *size) {
|
||||
inserted before insertBefore.
|
||||
*/
|
||||
static llvm::Value *
|
||||
lSizeOf(const llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
lSizeOf(LLVM_TYPE_CONST llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
// First try the easy case and see if we can get it as a simple
|
||||
// constant..
|
||||
uint64_t size;
|
||||
@@ -703,7 +703,7 @@ lSizeOf(const llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
// the pointer to the second element of an array of items of this type.
|
||||
// Then convert that pointer to an int and we've got the offset to the
|
||||
// second element in the array, a.k.a. the size of the type.
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||
llvm::Value *index[1] = { LLVMInt32(1) };
|
||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, &index[0], &index[1],
|
||||
@@ -721,13 +721,13 @@ lSizeOf(const llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
instructions that compute this value are inserted before insertBefore.
|
||||
*/
|
||||
static llvm::Value *
|
||||
lStructOffset(const llvm::Type *type, uint64_t member,
|
||||
lStructOffset(LLVM_TYPE_CONST llvm::Type *type, uint64_t member,
|
||||
llvm::Instruction *insertBefore) {
|
||||
// Do a similar trick to the one done in lSizeOf above; compute the
|
||||
// pointer to the member starting from a NULL base pointer and then
|
||||
// cast that 'pointer' to an int...
|
||||
assert(llvm::isa<const llvm::StructType>(type));
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||
llvm::Value *index[2] = { LLVMInt32(0), LLVMInt32((int32_t)member) };
|
||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, &index[0], &index[2],
|
||||
@@ -741,8 +741,9 @@ lStructOffset(const llvm::Type *type, uint64_t member,
|
||||
|
||||
|
||||
static llvm::Value *
|
||||
lGetTypeSize(const llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
const llvm::ArrayType *arrayType = llvm::dyn_cast<const llvm::ArrayType>(type);
|
||||
lGetTypeSize(LLVM_TYPE_CONST llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
LLVM_TYPE_CONST llvm::ArrayType *arrayType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::ArrayType>(type);
|
||||
if (arrayType != NULL)
|
||||
type = arrayType->getElementType();
|
||||
|
||||
@@ -756,7 +757,7 @@ lGetTypeSize(const llvm::Type *type, llvm::Instruction *insertBefore) {
|
||||
|
||||
static llvm::Value *
|
||||
lGetOffsetForLane(int lane, llvm::Value *value, llvm::Value **offset,
|
||||
const llvm::Type **scaleType, bool *leafIsVarying,
|
||||
LLVM_TYPE_CONST llvm::Type **scaleType, bool *leafIsVarying,
|
||||
llvm::Instruction *insertBefore) {
|
||||
if (!llvm::isa<llvm::GetElementPtrInst>(value)) {
|
||||
assert(llvm::isa<llvm::BitCastInst>(value));
|
||||
@@ -777,21 +778,22 @@ lGetOffsetForLane(int lane, llvm::Value *value, llvm::Value **offset,
|
||||
}
|
||||
|
||||
if (leafIsVarying != NULL) {
|
||||
const llvm::Type *pt = value->getType();
|
||||
const llvm::PointerType *ptrType = llvm::dyn_cast<const llvm::PointerType>(pt);
|
||||
LLVM_TYPE_CONST llvm::Type *pt = value->getType();
|
||||
LLVM_TYPE_CONST llvm::PointerType *ptrType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::PointerType>(pt);
|
||||
assert(ptrType);
|
||||
const llvm::Type *eltType = ptrType->getElementType();
|
||||
*leafIsVarying = llvm::isa<const llvm::VectorType>(eltType);
|
||||
LLVM_TYPE_CONST llvm::Type *eltType = ptrType->getElementType();
|
||||
*leafIsVarying = llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(eltType);
|
||||
}
|
||||
|
||||
llvm::GetElementPtrInst *gep = llvm::dyn_cast<llvm::GetElementPtrInst>(value);
|
||||
assert(gep);
|
||||
|
||||
assert(lGetIntValue(gep->getOperand(1)) == 0);
|
||||
const llvm::PointerType *targetPtrType =
|
||||
llvm::dyn_cast<const llvm::PointerType>(gep->getOperand(0)->getType());
|
||||
LLVM_TYPE_CONST llvm::PointerType *targetPtrType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::PointerType>(gep->getOperand(0)->getType());
|
||||
assert(targetPtrType);
|
||||
const llvm::Type *targetType = targetPtrType->getElementType();
|
||||
LLVM_TYPE_CONST llvm::Type *targetType = targetPtrType->getElementType();
|
||||
|
||||
if (llvm::isa<const llvm::StructType>(targetType)) {
|
||||
*offset = lStructOffset(targetType, lGetIntValue(gep->getOperand(2)),
|
||||
@@ -841,7 +843,7 @@ lGetOffsetForLane(int lane, llvm::Value *value, llvm::Value **offset,
|
||||
*/
|
||||
static llvm::Value *
|
||||
lTraverseInsertChain(llvm::Value *ptrs, llvm::Value *offsets[ISPC_MAX_NVEC],
|
||||
const llvm::Type **scaleType, bool *leafIsVarying,
|
||||
LLVM_TYPE_CONST llvm::Type **scaleType, bool *leafIsVarying,
|
||||
llvm::Instruction *insertBefore) {
|
||||
// This depends on the front-end constructing the arrays of pointers
|
||||
// via InsertValue instructions. (Which it does do in
|
||||
@@ -897,8 +899,8 @@ lTraverseInsertChain(llvm::Value *ptrs, llvm::Value *offsets[ISPC_MAX_NVEC],
|
||||
*/
|
||||
static llvm::Value *
|
||||
lSmearScalar(llvm::Value *scalar, llvm::Instruction *insertBefore) {
|
||||
const llvm::Type *vectorType = llvm::VectorType::get(scalar->getType(),
|
||||
g->target.vectorWidth);
|
||||
LLVM_TYPE_CONST llvm::Type *vectorType = llvm::VectorType::get(scalar->getType(),
|
||||
g->target.vectorWidth);
|
||||
llvm::Value *result = llvm::UndefValue::get(vectorType);
|
||||
for (int i = 0; i < g->target.vectorWidth; ++i) {
|
||||
result = llvm::InsertElementInst::Create(result, scalar, LLVMInt32(i),
|
||||
@@ -919,7 +921,7 @@ lGetPtrAndOffsets(llvm::Value *ptrs, llvm::Value **basePtr,
|
||||
llvm::Value *offsets[ISPC_MAX_NVEC];
|
||||
for (int i = 0; i < g->target.vectorWidth; ++i)
|
||||
offsets[i] = NULL;
|
||||
const llvm::Type *scaleType = NULL;
|
||||
LLVM_TYPE_CONST llvm::Type *scaleType = NULL;
|
||||
|
||||
llvm::Value *nextChain =
|
||||
lTraverseInsertChain(ptrs, offsets, &scaleType,
|
||||
@@ -1026,12 +1028,19 @@ GatherScatterFlattenOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
// Generate a new function call to the next pseudo gather
|
||||
// base+offsets instruction. Note that we're passing a NULL
|
||||
// llvm::BasicBlock to llvm::CallInst::Create; this means that
|
||||
// llvm::Instruction to llvm::CallInst::Create; this means that
|
||||
// the instruction isn't inserted into a basic block and that
|
||||
// way we can then call ReplaceInstWithInst().
|
||||
llvm::Value *newArgs[3] = { basePtr, offsetVector, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[3]);
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(gFunc, newArgArray, "newgather",
|
||||
(llvm::Instruction *)NULL);
|
||||
#else
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(gFunc, &newArgs[0], &newArgs[3], "newgather");
|
||||
#endif
|
||||
lCopyMetadata(newCall, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, newCall);
|
||||
}
|
||||
@@ -1045,10 +1054,17 @@ GatherScatterFlattenOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
|
||||
// Generate a new function call to the next pseudo scatter
|
||||
// base+offsets instruction. See above for why passing NULL
|
||||
// for the basic block is intended.
|
||||
// for the Instruction * is intended.
|
||||
llvm::Value *newArgs[4] = { basePtr, offsetVector, rvalue, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[4]);
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(gFunc, newArgArray, "",
|
||||
(llvm::Instruction *)NULL);
|
||||
#else
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(gFunc, &newArgs[0], &newArgs[4]);
|
||||
#endif
|
||||
lCopyMetadata(newCall, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, newCall);
|
||||
}
|
||||
@@ -1131,8 +1147,9 @@ MaskedStoreOptPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
}
|
||||
else if (maskAsInt == allOnMask) {
|
||||
// The mask is all on, so turn this into a regular store
|
||||
const llvm::Type *rvalueType = rvalue->getType();
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(rvalueType, 0);
|
||||
LLVM_TYPE_CONST llvm::Type *rvalueType = rvalue->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *ptrType =
|
||||
llvm::PointerType::get(rvalueType, 0);
|
||||
// Need to update this when int8/int16 are added
|
||||
int align = (called == pms32Func || called == pms64Func ||
|
||||
called == msb32Func) ? 4 : 8;
|
||||
@@ -1268,8 +1285,14 @@ LowerMaskedStorePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
llvm::Function *fms = m->module->getFunction(lMaskedStoreName(doBlend, is32));
|
||||
assert(fms);
|
||||
llvm::Value *args[3] = { lvalue, rvalue, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[3]);
|
||||
llvm::Instruction *inst = llvm::CallInst::Create(fms, newArgArray, "",
|
||||
callInst);
|
||||
#else
|
||||
llvm::Instruction *inst = llvm::CallInst::Create(fms, &args[0], &args[3], "",
|
||||
callInst);
|
||||
#endif
|
||||
lCopyMetadata(inst, callInst);
|
||||
|
||||
callInst->eraseFromParent();
|
||||
@@ -1445,11 +1468,11 @@ lScalarizeVector(llvm::Value *vec, llvm::Value *scalarizedVector[ISPC_MAX_NVEC])
|
||||
if (!lScalarizeVector(ci->getOperand(0), scalarizedTarget))
|
||||
return false;
|
||||
|
||||
const llvm::Type *destType = ci->getDestTy();
|
||||
const llvm::VectorType *vectorDestType =
|
||||
llvm::dyn_cast<const llvm::VectorType>(destType);
|
||||
LLVM_TYPE_CONST llvm::Type *destType = ci->getDestTy();
|
||||
LLVM_TYPE_CONST llvm::VectorType *vectorDestType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(destType);
|
||||
assert(vectorDestType != NULL);
|
||||
const llvm::Type *elementType = vectorDestType->getElementType();
|
||||
LLVM_TYPE_CONST llvm::Type *elementType = vectorDestType->getElementType();
|
||||
|
||||
for (int i = 0; i < g->target.vectorWidth; ++i) {
|
||||
scalarizedVector[i] =
|
||||
@@ -1467,19 +1490,19 @@ lScalarizeVector(llvm::Value *vec, llvm::Value *scalarizedVector[ISPC_MAX_NVEC])
|
||||
// an assert at the bottom of this routien will hit the first time
|
||||
// it runs as a reminder that this needs to be tested further.
|
||||
|
||||
const llvm::VectorType *svInstType =
|
||||
llvm::dyn_cast<const llvm::VectorType>(svi->getType());
|
||||
LLVM_TYPE_CONST llvm::VectorType *svInstType =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(svi->getType());
|
||||
assert(svInstType != NULL);
|
||||
assert((int)svInstType->getNumElements() == g->target.vectorWidth);
|
||||
|
||||
// Scalarize the two vectors being shuffled. First figure out how
|
||||
// big they are.
|
||||
const llvm::Type *type0 = svi->getOperand(0)->getType();
|
||||
const llvm::Type *type1 = svi->getOperand(1)->getType();
|
||||
const llvm::VectorType *vectorType0 =
|
||||
llvm::dyn_cast<const llvm::VectorType>(type0);
|
||||
const llvm::VectorType *vectorType1 =
|
||||
llvm::dyn_cast<const llvm::VectorType>(type1);
|
||||
LLVM_TYPE_CONST llvm::Type *type0 = svi->getOperand(0)->getType();
|
||||
LLVM_TYPE_CONST llvm::Type *type1 = svi->getOperand(1)->getType();
|
||||
LLVM_TYPE_CONST llvm::VectorType *vectorType0 =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(type0);
|
||||
LLVM_TYPE_CONST llvm::VectorType *vectorType1 =
|
||||
llvm::dyn_cast<LLVM_TYPE_CONST llvm::VectorType>(type1);
|
||||
assert(vectorType0 != NULL && vectorType1 != NULL);
|
||||
|
||||
int n0 = vectorType0->getNumElements();
|
||||
@@ -1926,9 +1949,16 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
"__load_and_broadcast_64");
|
||||
assert(loadBroadcast);
|
||||
llvm::Value *args[2] = { ptr, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[2]);
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(loadBroadcast, newArgArray,
|
||||
"load_broadcast", (llvm::Instruction *)NULL);
|
||||
#else
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(loadBroadcast, &args[0], &args[2],
|
||||
"load_broadcast");
|
||||
#endif
|
||||
lCopyMetadata(newCall, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, newCall);
|
||||
}
|
||||
@@ -1984,8 +2014,15 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
assert(loadMasked);
|
||||
|
||||
llvm::Value *args[2] = { ptr, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[2]);
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(loadMasked, argArray, "load_masked",
|
||||
(llvm::Instruction *)NULL);
|
||||
#else
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(loadMasked, &args[0], &args[2], "load_masked");
|
||||
#endif
|
||||
lCopyMetadata(newCall, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, newCall);
|
||||
}
|
||||
@@ -2000,13 +2037,20 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
m->module->getFunction(is32 ? "__pseudo_masked_store_32" :
|
||||
"__pseudo_masked_store_64");
|
||||
assert(storeMasked);
|
||||
const llvm::Type *vecPtrType = is32 ?
|
||||
LLVM_TYPE_CONST llvm::Type *vecPtrType = is32 ?
|
||||
LLVMTypes::Int32VectorPointerType : LLVMTypes::Int64VectorPointerType;
|
||||
ptr = new llvm::BitCastInst(ptr, vecPtrType, "ptrcast", callInst);
|
||||
|
||||
llvm::Value *args[3] = { ptr, rvalue, mask };
|
||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
||||
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[3]);
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(storeMasked, argArray, "",
|
||||
(llvm::Instruction *)NULL);
|
||||
#else
|
||||
llvm::Instruction *newCall =
|
||||
llvm::CallInst::Create(storeMasked, &args[0], &args[3], "");
|
||||
#endif
|
||||
lCopyMetadata(newCall, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, newCall);
|
||||
}
|
||||
|
||||
8
stmt.cpp
8
stmt.cpp
@@ -133,7 +133,7 @@ lInitSymbol(llvm::Value *lvalue, const char *symName, const Type *type,
|
||||
// Initialize things without initializers to the undefined value.
|
||||
// To auto-initialize everything to zero, replace 'UndefValue' with
|
||||
// 'NullValue' in the below
|
||||
const llvm::Type *ltype = type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *ltype = type->LLVMType(g->ctx);
|
||||
ctx->StoreInst(llvm::UndefValue::get(ltype), lvalue);
|
||||
return;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
|
||||
continue;
|
||||
}
|
||||
|
||||
const llvm::Type *llvmType = type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *llvmType = type->LLVMType(g->ctx);
|
||||
assert(llvmType != NULL);
|
||||
|
||||
if (declaration->declSpecs->storageClass == SC_STATIC) {
|
||||
@@ -1414,7 +1414,7 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) {
|
||||
else {
|
||||
argTypes.push_back(t);
|
||||
|
||||
const llvm::Type *llvmExprType = type->LLVMType(g->ctx);
|
||||
LLVM_TYPE_CONST llvm::Type *llvmExprType = type->LLVMType(g->ctx);
|
||||
llvm::Value *ptr = ctx->AllocaInst(llvmExprType, "print_arg");
|
||||
llvm::Value *val = expr->GetValue(ctx);
|
||||
if (!val)
|
||||
@@ -1460,7 +1460,7 @@ PrintStmt::EmitCode(FunctionEmitContext *ctx) const {
|
||||
int nArgs = elist ? elist->exprs.size() : 1;
|
||||
|
||||
// Allocate space for the array of pointers to values to be printed
|
||||
const llvm::Type *argPtrArrayType =
|
||||
LLVM_TYPE_CONST llvm::Type *argPtrArrayType =
|
||||
llvm::ArrayType::get(LLVMTypes::VoidPointerType, nArgs);
|
||||
llvm::Value *argPtrArray = ctx->AllocaInst(argPtrArrayType,
|
||||
"print_arg_ptrs");
|
||||
|
||||
7
type.cpp
7
type.cpp
@@ -582,9 +582,14 @@ EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
m->diBuilder->createEnumerator(enumerators[i]->name, enumeratorValue);
|
||||
enumeratorDescriptors.push_back(descriptor);
|
||||
}
|
||||
#ifdef LLVM_2_9
|
||||
llvm::DIArray elementArray =
|
||||
m->diBuilder->getOrCreateArray(&enumeratorDescriptors[0],
|
||||
enumeratorDescriptors.size());
|
||||
#else
|
||||
llvm::DIArray elementArray =
|
||||
m->diBuilder->getOrCreateArray(enumeratorDescriptors);
|
||||
#endif
|
||||
|
||||
llvm::DIFile diFile = pos.GetDIFile();
|
||||
llvm::DIType diType =
|
||||
@@ -1775,7 +1780,7 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
||||
}
|
||||
|
||||
|
||||
const llvm::FunctionType *
|
||||
LLVM_TYPE_CONST llvm::FunctionType *
|
||||
FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
|
||||
if (!includeMask && isTask) {
|
||||
Error(pos, "Function can't have both \"task\" and \"export\" qualifiers");
|
||||
|
||||
4
type.h
4
type.h
@@ -660,8 +660,8 @@ public:
|
||||
function type. The \c includeMask parameter indicates whether the
|
||||
llvm::FunctionType should have a mask as the last argument in its
|
||||
function signature. */
|
||||
const llvm::FunctionType *LLVMFunctionType(llvm::LLVMContext *ctx,
|
||||
bool includeMask = false) const;
|
||||
LLVM_TYPE_CONST llvm::FunctionType *LLVMFunctionType(llvm::LLVMContext *ctx,
|
||||
bool includeMask = false) const;
|
||||
|
||||
const std::vector<const Type *> &GetArgumentTypes() const { return argTypes; }
|
||||
const std::vector<ConstExpr *> &GetArgumentDefaults() const { return argDefaults; }
|
||||
|
||||
Reference in New Issue
Block a user