diff options
author | Logan Chien <loganchien@google.com> | 2011-07-20 21:31:09 +0800 |
---|---|---|
committer | Logan Chien <loganchien@google.com> | 2011-07-20 21:31:15 +0800 |
commit | ae0c16b29d641afaff99ac106eff87fea72a23e6 (patch) | |
tree | 510a5f088cddd652e12243ca2bfdd1c8761db191 | |
parent | 0783e59a538573e2949aa558cd26e3714f9ffd7e (diff) |
Apply changes to migrate to llvm r135568.
LLVM changes several APIs, which require us to pass
non-const llvm::Type.
Change-Id: Iaf47425b1ace79d7d94ce1111846b983d386c285
-rw-r--r-- | src/glsl/ir_to_llvm.cpp | 26 | ||||
-rw-r--r-- | src/pixelflinger2/llvm_scanline.cpp | 14 | ||||
-rw-r--r-- | src/pixelflinger2/llvm_texture.cpp | 14 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/glsl/ir_to_llvm.cpp b/src/glsl/ir_to_llvm.cpp index 387fc08..8d35dc4 100644 --- a/src/glsl/ir_to_llvm.cpp +++ b/src/glsl/ir_to_llvm.cpp @@ -108,7 +108,7 @@ public: inputsPtr(NULL), outputsPtr(NULL), constantsPtr(NULL), inputs(NULL), outputs(NULL), constants(NULL) { - const llvm::PointerType * const floatVecPtrType = llvm::PointerType::get(llvm::VectorType::get(bld.getFloatTy(),4), 0); + llvm::PointerType * const floatVecPtrType = llvm::PointerType::get(llvm::VectorType::get(bld.getFloatTy(),4), 0); llvm::Constant * const nullFloatVecPtr = llvm::Constant::getNullValue(floatVecPtrType); // make input, output and consts global pointers so they can be used in // different LLVM functions since the shader shares these "registers" across "functions" @@ -123,7 +123,7 @@ public: llvm::GlobalValue::InternalLinkage, nullFloatVecPtr, "gl_constantsPtr"); } - const llvm::Type* llvm_base_type(unsigned base_type) + llvm::Type* llvm_base_type(unsigned base_type) { switch(base_type) { @@ -158,7 +158,7 @@ public: fields)); } - llvm::Type* base_type = (llvm::Type*) llvm_base_type(type->base_type); + llvm::Type* base_type = llvm_base_type(type->base_type); if (type->vector_elements <= 1) { return base_type; } else { @@ -186,7 +186,7 @@ public: if (vari != llvm_variables.end()) { return vari->second; } else { - const llvm::Type* type = llvm_type(var->type); + llvm::Type* type = llvm_type(var->type); llvm::Value* v = NULL; if(fun) { @@ -350,13 +350,13 @@ public: // llvm::Value* llvm_intrinsic(llvm::Intrinsic::ID id, llvm::Value* a) // { -// const llvm::Type* types[1] = {a->getType()}; +// llvm::Type* types[1] = {a->getType()}; // return bld.CreateCall(llvm::Intrinsic::getDeclaration(mod, id, types, 1), a); // } // // llvm::Value* llvm_intrinsic(llvm::Intrinsic::ID id, llvm::Value* a, llvm::Value* b) // { -// const llvm::Type* types[2] = {a->getType(), b->getType()}; +// llvm::Type* types[2] = {a->getType(), b->getType()}; // /* only one type suffix is usually needed, so pass 1 here */ // return bld.CreateCall2(llvm::Intrinsic::getDeclaration(mod, id, types, 1), a, b); // } @@ -442,7 +442,7 @@ public: static llvm::Value* create_shuffle3(llvm::IRBuilder<>& bld, llvm::Value* v, unsigned a, unsigned b, unsigned c, const llvm::Twine& name = "") { - const llvm::Type* int_ty = llvm::Type::getInt32Ty(v->getContext()); + llvm::Type* int_ty = llvm::Type::getInt32Ty(v->getContext()); llvm::Constant* vals[3] = {llvm::ConstantInt::get(int_ty, a), llvm::ConstantInt::get(int_ty, b), llvm::ConstantInt::get(int_ty, c)}; return bld.CreateShuffleVector(v, llvm::UndefValue::get(v->getType()), llvm::ConstantVector::get(pack(vals)), name); } @@ -452,7 +452,7 @@ public: if (1 == width) return bld.CreateSelect(cond, tru, fal, name); - const llvm::Type * vectorType = tru->getType(); + llvm::Type * vectorType = tru->getType(); llvm::Value * vector = llvm::Constant::getNullValue(vectorType); for (unsigned int i = 0; i < width; i++) { llvm::Value * c = bld.CreateExtractElement(cond, llvm_int(i)); @@ -1135,9 +1135,9 @@ public: } else { - const llvm::Type* base_type = llvm_base_type(ir->type->base_type); - const llvm::Type* vec_type = llvm_vec_type(ir->type); - const llvm::Type* type = llvm_type(ir->type); + llvm::Type* base_type = llvm_base_type(ir->type->base_type); + llvm::Type* vec_type = llvm_vec_type(ir->type); + llvm::Type* type = llvm_type(ir->type); std::vector<llvm::Constant*> vecs; unsigned idx = 0; @@ -1183,8 +1183,8 @@ public: llvm::Value* llvm_shuffle(llvm::Value* val, int* shuffle_mask, unsigned res_width, const llvm::Twine &name = "") { - const llvm::Type* elem_type = val->getType(); - const llvm::Type* res_type = elem_type;; + llvm::Type* elem_type = val->getType(); + llvm::Type* res_type = elem_type;; unsigned val_width = 1; if(val->getType()->isVectorTy()) { diff --git a/src/pixelflinger2/llvm_scanline.cpp b/src/pixelflinger2/llvm_scanline.cpp index 893b925..f8a7c11 100644 --- a/src/pixelflinger2/llvm_scanline.cpp +++ b/src/pixelflinger2/llvm_scanline.cpp @@ -261,7 +261,7 @@ static Value * ScreenColorToIntVector(IRBuilder<> & builder, const GGLPixelForma Value * GenerateFSBlend(const GGLState * gglCtx, const GGLPixelFormat format, /*const RegDesc * regDesc,*/ IRBuilder<> & builder, Value * src, Value * dst) { - const Type * const intType = builder.getInt32Ty(); + Type * const intType = builder.getInt32Ty(); // TODO cast the outputs pointer type to int for writing to minimize bandwidth if (!gglCtx->blendState.enable) { @@ -451,10 +451,10 @@ void GenerateScanLine(const GGLState * gglCtx, const gl_shader_program * program IRBuilder<> builder(mod->getContext()); // debug_printf("GenerateScanLine %s \n", scanlineName); - const Type * intType = builder.getInt32Ty(); - const PointerType * intPointerType = PointerType::get(intType, 0); - const Type * byteType = builder.getInt8Ty(); - const PointerType * bytePointerType = PointerType::get(byteType, 0); + Type * intType = builder.getInt32Ty(); + PointerType * intPointerType = PointerType::get(intType, 0); + Type * byteType = builder.getInt8Ty(); + PointerType * bytePointerType = PointerType::get(byteType, 0); Function * func = mod->getFunction(scanlineName); if (func) @@ -696,8 +696,8 @@ void GenerateScanLine(const GGLState * gglCtx, const gl_shader_program * program v = builder.CreateFAdd(v, dx); builder.CreateStore(v, vPtr); } else if (gglCtx->bufferState.depthTest) { - const Type * floatType = builder.getFloatTy(); - const PointerType * floatPointerType = PointerType::get(floatType, 0); + Type * floatType = builder.getFloatTy(); + PointerType * floatPointerType = PointerType::get(floatType, 0); vPtr = builder.CreateBitCast(start, floatPointerType); vPtr = builder.CreateConstInBoundsGEP1_32(vPtr, (GGL_FS_INPUT_OFFSET + GGL_FS_INPUT_FRAGCOORD_INDEX) * 4 + 2); diff --git a/src/pixelflinger2/llvm_texture.cpp b/src/pixelflinger2/llvm_texture.cpp index f3d2bea..5adafc1 100644 --- a/src/pixelflinger2/llvm_texture.cpp +++ b/src/pixelflinger2/llvm_texture.cpp @@ -221,7 +221,7 @@ static Value * texcoordWrap(IRBuilder<> & builder, const unsigned wrap, /*const ChannelType type,*/ Value * r, Value * size, Value * dim, Value ** texelLerp) { - const Type * intType = Type::getInt32Ty(builder.getContext()); + Type * intType = Type::getInt32Ty(builder.getContext()); Value * tc = NULL; Value * odd = NULL; // if (Float == type) { @@ -275,8 +275,8 @@ Value * tex2D(IRBuilder<> & builder, Value * in1, const unsigned sampler, /*const RegDesc * in1Desc, const RegDesc * dstDesc,*/ const GGLState * gglCtx) { - const Type * intType = builder.getInt32Ty(); - const PointerType * intPointerType = PointerType::get(intType, 0); + Type * intType = builder.getInt32Ty(); + PointerType * intPointerType = PointerType::get(intType, 0); llvm::Module * module = builder.GetInsertBlock()->getParent()->getParent(); std::vector<Value * > texcoords = extractVector(builder, in1); @@ -337,7 +337,7 @@ Value * tex2D(IRBuilder<> & builder, Value * in1, const unsigned sampler, // only positive float; used in cube map since major axis is positive static Value * FCmpGT(IRBuilder<> & builder, Value * lhs, Value * rhs) { - const Type * const intType = Type::getInt32Ty(builder.getContext()); + Type * const intType = Type::getInt32Ty(builder.getContext()); lhs = builder.CreateBitCast(lhs, intType); rhs = builder.CreateBitCast(rhs, intType); return builder.CreateICmpUGT(lhs, rhs); @@ -368,9 +368,9 @@ Value * texCube(IRBuilder<> & builder, Value * in1, const unsigned sampler, // if (in1Desc) // the major axis determination code is only float for now // assert(in1Desc->IsVectorType(Float)); - const Type * const intType = builder.getInt32Ty(); - const PointerType * const intPointerType = PointerType::get(intType, 0); - const Type * const floatType = builder.getFloatTy(); + Type * const intType = builder.getInt32Ty(); + PointerType * const intPointerType = PointerType::get(intType, 0); + Type * const floatType = builder.getFloatTy(); Constant * const float1 = constFloat(builder, 1.0f); Constant * const float0_5 = constFloat(builder, 0.5f); |