summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/gallivm/Makefile12
-rw-r--r--src/gallium/auxiliary/gallivm/instructions.cpp42
-rw-r--r--src/gallium/auxiliary/gallivm/instructions.h4
-rw-r--r--src/gallium/auxiliary/gallivm/instructionssoa.cpp49
-rw-r--r--src/gallium/auxiliary/gallivm/instructionssoa.h4
-rw-r--r--src/gallium/auxiliary/gallivm/storage.cpp32
-rw-r--r--src/gallium/auxiliary/gallivm/storagesoa.cpp10
-rw-r--r--src/gallium/auxiliary/gallivm/tgsitollvm.cpp4
8 files changed, 79 insertions, 78 deletions
diff --git a/src/gallium/auxiliary/gallivm/Makefile b/src/gallium/auxiliary/gallivm/Makefile
index 6bfd187fb3..c3f7bfba93 100644
--- a/src/gallium/auxiliary/gallivm/Makefile
+++ b/src/gallium/auxiliary/gallivm/Makefile
@@ -65,14 +65,14 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES)
gallivm_builtins.cpp: llvm_builtins.c
- clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp.bin
- (echo "static const unsigned char llvm_builtins_data[] = {"; od -txC temp.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
- rm temp.bin
+ clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp1.bin
+ (echo "static const unsigned char llvm_builtins_data[] = {"; od -txC temp1.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
+ rm temp1.bin
gallivmsoabuiltins.cpp: soabuiltins.c
- clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp.bin
- (echo "static const unsigned char soabuiltins_data[] = {"; od -txC temp.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
- rm temp.bin
+ clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp2.bin
+ (echo "static const unsigned char soabuiltins_data[] = {"; od -txC temp2.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
+ rm temp2.bin
# Emacs tags
tags:
diff --git a/src/gallium/auxiliary/gallivm/instructions.cpp b/src/gallium/auxiliary/gallivm/instructions.cpp
index b35d6790f7..95a670edaf 100644
--- a/src/gallium/auxiliary/gallivm/instructions.cpp
+++ b/src/gallium/auxiliary/gallivm/instructions.cpp
@@ -139,12 +139,12 @@ llvm::Value *Instructions::callFSqrt(llvm::Value *val)
// predeclare the intrinsic
std::vector<const Type*> fsqrtArgs;
fsqrtArgs.push_back(Type::FloatTy);
- ParamAttrsList *fsqrtPal = 0;
+ PAListPtr fsqrtPal;
FunctionType* fsqrtType = FunctionType::get(
/*Result=*/Type::FloatTy,
/*Params=*/fsqrtArgs,
/*isVarArg=*/false);
- m_llvmFSqrt = new Function(
+ m_llvmFSqrt = Function::Create(
/*Type=*/fsqrtType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"llvm.sqrt.f32", m_mod);
@@ -196,12 +196,12 @@ llvm::Value *Instructions::callFAbs(llvm::Value *val)
// predeclare the intrinsic
std::vector<const Type*> fabsArgs;
fabsArgs.push_back(Type::FloatTy);
- ParamAttrsList *fabsPal = 0;
+ PAListPtr fabsPal;
FunctionType* fabsType = FunctionType::get(
/*Result=*/Type::FloatTy,
/*Params=*/fabsArgs,
/*isVarArg=*/false);
- m_llvmFAbs = new Function(
+ m_llvmFAbs = Function::Create(
/*Type=*/fabsType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"fabs", m_mod);
@@ -239,12 +239,12 @@ llvm::Value * Instructions::callPow(llvm::Value *val1, llvm::Value *val2)
std::vector<const Type*> powArgs;
powArgs.push_back(Type::FloatTy);
powArgs.push_back(Type::FloatTy);
- ParamAttrsList *powPal = 0;
+ PAListPtr powPal;
FunctionType* powType = FunctionType::get(
/*Result=*/Type::FloatTy,
/*Params=*/powArgs,
/*isVarArg=*/false);
- m_llvmPow = new Function(
+ m_llvmPow = Function::Create(
/*Type=*/powType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"llvm.pow.f32", m_mod);
@@ -338,12 +338,12 @@ llvm::Value * Instructions::callFloor(llvm::Value *val)
// predeclare the intrinsic
std::vector<const Type*> floorArgs;
floorArgs.push_back(Type::FloatTy);
- ParamAttrsList *floorPal = 0;
+ PAListPtr floorPal;
FunctionType* floorType = FunctionType::get(
/*Result=*/Type::FloatTy,
/*Params=*/floorArgs,
/*isVarArg=*/false);
- m_llvmFloor = new Function(
+ m_llvmFloor = Function::Create(
/*Type=*/floorType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"floorf", m_mod);
@@ -381,12 +381,12 @@ llvm::Value * Instructions::callFLog(llvm::Value *val)
// predeclare the intrinsic
std::vector<const Type*> flogArgs;
flogArgs.push_back(Type::FloatTy);
- ParamAttrsList *flogPal = 0;
+ PAListPtr flogPal;
FunctionType* flogType = FunctionType::get(
/*Result=*/Type::FloatTy,
/*Params=*/flogArgs,
/*isVarArg=*/false);
- m_llvmFlog = new Function(
+ m_llvmFlog = Function::Create(
/*Type=*/flogType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"logf", m_mod);
@@ -509,12 +509,12 @@ void Instructions::printVector(llvm::Value *val)
llvm::Function * Instructions::declarePrintf()
{
std::vector<const Type*> args;
- ParamAttrsList *params = 0;
+ PAListPtr params;
FunctionType* funcTy = FunctionType::get(
/*Result=*/IntegerType::get(32),
/*Params=*/args,
/*isVarArg=*/true);
- Function* func_printf = new Function(
+ Function* func_printf = Function::Create(
/*Type=*/funcTy,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"printf", m_mod);
@@ -638,8 +638,8 @@ llvm::Value * Instructions::abs(llvm::Value *in)
void Instructions::ifop(llvm::Value *in)
{
- BasicBlock *ifthen = new BasicBlock(name("ifthen"), m_func,0);
- BasicBlock *ifend = new BasicBlock(name("ifthenend"), m_func,0);
+ BasicBlock *ifthen = BasicBlock::Create(name("ifthen"), m_func,0);
+ BasicBlock *ifend = BasicBlock::Create(name("ifthenend"), m_func,0);
//BasicBlock *yblock = new BasicBlock(name("yblock"), m_func,0);
//BasicBlock *zblock = new BasicBlock(name("zblock"), m_func,0);
@@ -665,7 +665,7 @@ llvm::BasicBlock * Instructions::currentBlock() const
void Instructions::elseop()
{
assert(!m_ifStack.empty());
- BasicBlock *ifend = new BasicBlock(name("ifend"), m_func,0);
+ BasicBlock *ifend = BasicBlock::Create(name("ifend"), m_func,0);
m_builder.CreateBr(ifend);
m_builder.SetInsertPoint(m_ifStack.top());
currentBlock()->setName(name("ifelse"));
@@ -692,8 +692,8 @@ llvm::Value * Instructions::lerp(llvm::Value *in1, llvm::Value *in2,
void Instructions::beginLoop()
{
- BasicBlock *begin = new BasicBlock(name("loop"), m_func,0);
- BasicBlock *end = new BasicBlock(name("endloop"), m_func,0);
+ BasicBlock *begin = BasicBlock::Create(name("loop"), m_func,0);
+ BasicBlock *end = BasicBlock::Create(name("endloop"), m_func,0);
m_builder.CreateBr(begin);
Loop loop;
@@ -716,7 +716,7 @@ void Instructions::endLoop()
void Instructions::brk()
{
assert(!m_loopStack.empty());
- BasicBlock *unr = new BasicBlock(name("unreachable"), m_func,0);
+ BasicBlock *unr = BasicBlock::Create(name("unreachable"), m_func,0);
m_builder.CreateBr(m_loopStack.top().end);
m_builder.SetInsertPoint(unr);
}
@@ -765,13 +765,13 @@ llvm::Function * Instructions::declareFunc(int label)
args.push_back(vecPtr);
args.push_back(vecPtr);
args.push_back(vecPtr);
- ParamAttrsList *params = 0;
+ PAListPtr params;
FunctionType *funcType = FunctionType::get(
/*Result=*/Type::VoidTy,
/*Params=*/args,
/*isVarArg=*/false);
std::string name = createFuncName(label);
- Function *func = new Function(
+ Function *func = Function::Create(
/*Type=*/funcType,
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/name.c_str(), m_mod);
@@ -789,7 +789,7 @@ void Instructions::bgnSub(unsigned label)
ptr_INPUT->setName("INPUT");
m_storage->pushArguments(ptr_INPUT);
- llvm::BasicBlock *entry = new BasicBlock("entry", func, 0);
+ llvm::BasicBlock *entry = BasicBlock::Create("entry", func, 0);
m_func = func;
m_builder.SetInsertPoint(entry);
diff --git a/src/gallium/auxiliary/gallivm/instructions.h b/src/gallium/auxiliary/gallivm/instructions.h
index 9ebc17dd8e..19ca84ddc6 100644
--- a/src/gallium/auxiliary/gallivm/instructions.h
+++ b/src/gallium/auxiliary/gallivm/instructions.h
@@ -36,7 +36,7 @@
#include <llvm/BasicBlock.h>
#include <llvm/Module.h>
#include <llvm/Value.h>
-#include <llvm/Support/LLVMBuilder.h>
+#include <llvm/Support/IRBuilder.h>
#include <map>
#include <stack>
@@ -125,7 +125,7 @@ private:
llvm::Module *m_mod;
llvm::Function *m_func;
char m_name[32];
- llvm::LLVMFoldingBuilder m_builder;
+ llvm::IRBuilder m_builder;
int m_idx;
llvm::VectorType *m_floatVecType;
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
index 3c16a3692d..f0122802db 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
@@ -38,6 +38,7 @@
#include <llvm/Instructions.h>
#include <llvm/Transforms/Utils/Cloning.h>
#include <llvm/ParameterAttributes.h>
+//#include <llvm/ParamAttrsList.h>
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/Bitcode/ReaderWriter.h>
@@ -237,32 +238,32 @@ llvm::Value * InstructionsSoa::allocaTemp()
std::vector<Value*> indices;
indices.push_back(m_storage->constantInt(0));
indices.push_back(m_storage->constantInt(0));
- GetElementPtrInst *getElem = new GetElementPtrInst(alloca,
- indices.begin(),
- indices.end(),
- name("allocaPtr"),
- m_builder.GetInsertBlock());
+ GetElementPtrInst *getElem = GetElementPtrInst::Create(alloca,
+ indices.begin(),
+ indices.end(),
+ name("allocaPtr"),
+ m_builder.GetInsertBlock());
return getElem;
}
std::vector<llvm::Value*> InstructionsSoa::allocaToResult(llvm::Value *allocaPtr)
{
- GetElementPtrInst *xElemPtr = new GetElementPtrInst(allocaPtr,
- m_storage->constantInt(0),
- name("xPtr"),
- m_builder.GetInsertBlock());
- GetElementPtrInst *yElemPtr = new GetElementPtrInst(allocaPtr,
- m_storage->constantInt(1),
- name("yPtr"),
- m_builder.GetInsertBlock());
- GetElementPtrInst *zElemPtr = new GetElementPtrInst(allocaPtr,
- m_storage->constantInt(2),
- name("zPtr"),
- m_builder.GetInsertBlock());
- GetElementPtrInst *wElemPtr = new GetElementPtrInst(allocaPtr,
- m_storage->constantInt(3),
- name("wPtr"),
- m_builder.GetInsertBlock());
+ GetElementPtrInst *xElemPtr = GetElementPtrInst::Create(allocaPtr,
+ m_storage->constantInt(0),
+ name("xPtr"),
+ m_builder.GetInsertBlock());
+ GetElementPtrInst *yElemPtr = GetElementPtrInst::Create(allocaPtr,
+ m_storage->constantInt(1),
+ name("yPtr"),
+ m_builder.GetInsertBlock());
+ GetElementPtrInst *zElemPtr = GetElementPtrInst::Create(allocaPtr,
+ m_storage->constantInt(2),
+ name("zPtr"),
+ m_builder.GetInsertBlock());
+ GetElementPtrInst *wElemPtr = GetElementPtrInst::Create(allocaPtr,
+ m_storage->constantInt(3),
+ name("wPtr"),
+ m_builder.GetInsertBlock());
std::vector<llvm::Value*> res(4);
res[0] = new LoadInst(xElemPtr, name("xRes"), false, m_builder.GetInsertBlock());
@@ -388,10 +389,10 @@ void InstructionsSoa::injectFunction(llvm::Function *originalFunc, int op)
llvm::Function *func = 0;
if (originalFunc->isDeclaration()) {
std::cout << "function decleration" <<std::endl;
- func = new Function(originalFunc->getFunctionType(), GlobalValue::ExternalLinkage,
- originalFunc->getName(), currentModule());
+ func = Function::Create(originalFunc->getFunctionType(), GlobalValue::ExternalLinkage,
+ originalFunc->getName(), currentModule());
func->setCallingConv(CallingConv::C);
- const ParamAttrsList *pal = 0;
+ const PAListPtr pal;
func->setParamAttrs(pal);
currentModule()->dump();
} else {
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.h b/src/gallium/auxiliary/gallivm/instructionssoa.h
index b9104ea286..060ee72f2e 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.h
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.h
@@ -29,7 +29,7 @@
#define INSTRUCTIONSSOA_H
#include <pipe/p_shader_tokens.h>
-#include <llvm/Support/LLVMBuilder.h>
+#include <llvm/Support/IRBuilder.h>
#include <map>
#include <vector>
@@ -87,7 +87,7 @@ private:
const std::vector<llvm::Value*> in3);
void injectFunction(llvm::Function *originalFunc, int op = TGSI_OPCODE_LAST);
private:
- llvm::LLVMFoldingBuilder m_builder;
+ llvm::IRBuilder m_builder;
StorageSoa *m_storage;
std::map<int, std::string> m_functionsMap;
diff --git a/src/gallium/auxiliary/gallivm/storage.cpp b/src/gallium/auxiliary/gallivm/storage.cpp
index c4326de8c5..9d9fd12360 100644
--- a/src/gallium/auxiliary/gallivm/storage.cpp
+++ b/src/gallium/auxiliary/gallivm/storage.cpp
@@ -186,26 +186,26 @@ llvm::Value *Storage::maskWrite(llvm::Value *src, int mask, llvm::Value *templ)
if ((mask & TGSI_WRITEMASK_X)) {
llvm::Value *x = new ExtractElementInst(src, unsigned(0),
name("x"), m_block);
- dst = new InsertElementInst(dst, x, unsigned(0),
- name("dstx"), m_block);
+ dst = InsertElementInst::Create(dst, x, unsigned(0),
+ name("dstx"), m_block);
}
if ((mask & TGSI_WRITEMASK_Y)) {
llvm::Value *y = new ExtractElementInst(src, unsigned(1),
name("y"), m_block);
- dst = new InsertElementInst(dst, y, unsigned(1),
- name("dsty"), m_block);
+ dst = InsertElementInst::Create(dst, y, unsigned(1),
+ name("dsty"), m_block);
}
if ((mask & TGSI_WRITEMASK_Z)) {
llvm::Value *z = new ExtractElementInst(src, unsigned(2),
name("z"), m_block);
- dst = new InsertElementInst(dst, z, unsigned(2),
- name("dstz"), m_block);
+ dst = InsertElementInst::Create(dst, z, unsigned(2),
+ name("dstz"), m_block);
}
if ((mask & TGSI_WRITEMASK_W)) {
llvm::Value *w = new ExtractElementInst(src, unsigned(3),
name("w"), m_block);
- dst = new InsertElementInst(dst, w, unsigned(3),
- name("dstw"), m_block);
+ dst = InsertElementInst::Create(dst, w, unsigned(3),
+ name("dstw"), m_block);
}
return dst;
}
@@ -308,11 +308,11 @@ llvm::Value * Storage::elemPtr(Args arg)
std::vector<Value*> indices;
indices.push_back(constantInt(0));
indices.push_back(constantInt(static_cast<int>(arg)));
- GetElementPtrInst *getElem = new GetElementPtrInst(m_INPUT,
- indices.begin(),
- indices.end(),
- name("input_ptr"),
- m_block);
+ GetElementPtrInst *getElem = GetElementPtrInst::Create(m_INPUT,
+ indices.begin(),
+ indices.end(),
+ name("input_ptr"),
+ m_block);
return new LoadInst(getElem, name("input_field"), false, m_block);
}
@@ -322,7 +322,7 @@ llvm::Value * Storage::elemIdx(llvm::Value *ptr, int idx,
GetElementPtrInst *getElem = 0;
if (indIdx) {
- getElem = new GetElementPtrInst(ptr,
+ getElem = GetElementPtrInst::Create(ptr,
BinaryOperator::create(Instruction::Add,
indIdx,
constantInt(idx),
@@ -331,7 +331,7 @@ llvm::Value * Storage::elemIdx(llvm::Value *ptr, int idx,
name("field"),
m_block);
} else {
- getElem = new GetElementPtrInst(ptr,
+ getElem = GetElementPtrInst::Create(ptr,
constantInt(idx),
name("field"),
m_block);
@@ -350,7 +350,7 @@ void Storage::setKilElement(llvm::Value *val)
std::vector<Value*> indices;
indices.push_back(constantInt(0));
indices.push_back(constantInt(static_cast<int>(KilArg)));
- GetElementPtrInst *elem = new GetElementPtrInst(m_INPUT,
+ GetElementPtrInst *elem = GetElementPtrInst::Create(m_INPUT,
indices.begin(),
indices.end(),
name("kil_ptr"),
diff --git a/src/gallium/auxiliary/gallivm/storagesoa.cpp b/src/gallium/auxiliary/gallivm/storagesoa.cpp
index bb6fe3d7e1..0e6e68c9d7 100644
--- a/src/gallium/auxiliary/gallivm/storagesoa.cpp
+++ b/src/gallium/auxiliary/gallivm/storagesoa.cpp
@@ -207,11 +207,11 @@ llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, llvm::Value *index,
indices.push_back(index);
indices.push_back(constantInt(channel));
- GetElementPtrInst *getElem = new GetElementPtrInst(ptr,
- indices.begin(),
- indices.end(),
- name("ptr"),
- m_block);
+ GetElementPtrInst *getElem = GetElementPtrInst::Create(ptr,
+ indices.begin(),
+ indices.end(),
+ name("ptr"),
+ m_block);
return getElem;
}
diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
index ab9e7a06fb..ab8c851f14 100644
--- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
+++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
@@ -1014,7 +1014,7 @@ tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens)
Value *ptr_INPUT = args++;
ptr_INPUT->setName("input");
- BasicBlock *label_entry = new BasicBlock("entry", shader, 0);
+ BasicBlock *label_entry = BasicBlock::Create("entry", shader, 0);
tgsi_parse_init(&parse, tokens);
@@ -1085,7 +1085,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir,
Value *temps = args++;
temps->setName("temps");
- BasicBlock *label_entry = new BasicBlock("entry", shader, 0);
+ BasicBlock *label_entry = BasicBlock::Create("entry", shader, 0);
tgsi_parse_init(&parse, tokens);