Deprecate support for constant pointers. The use of constant pointers produces code that cannot be relocated. They also cause issues in Subzero when offsetting them due to not having constant folding support. We only used them for Direct3D cursor rendering, which can just pass in the data as an argument instead. Bug swiftshader:14 Change-Id: Id7f16c3fcaeed3fe64b569af6a49c32f6baec483 Reviewed-on: https://swiftshader-review.googlesource.com/8257 Reviewed-by: Nicolas Capens <capn@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index efcd874..2b7da2c 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -705,26 +705,7 @@ mask[3] ? 7 : 3, }; - Value *shuffle = Nucleus::createShuffleVector(lhs, rhs, swizzle); - - return shuffle; - } - - Value *Nucleus::createConstantPointer(const void *address, Type *Ty, unsigned int align) - { - const GlobalValue *existingGlobal = ::executionEngine->getGlobalValueAtAddress(const_cast<void*>(address)); // FIXME: Const - - if(existingGlobal) - { - return (Value*)existingGlobal; - } - - llvm::GlobalValue *global = new llvm::GlobalVariable(*::module, Ty, true, llvm::GlobalValue::ExternalLinkage, 0, ""); - global->setAlignment(align); - - ::executionEngine->addGlobalMapping(global, const_cast<void*>(address)); - - return V(global); + return Nucleus::createShuffleVector(lhs, rhs, swizzle); } Type *Nucleus::getPointerType(Type *ElementType)
diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp index ddca385..8307800 100644 --- a/src/Reactor/Nucleus.hpp +++ b/src/Reactor/Nucleus.hpp
@@ -163,7 +163,6 @@ static Value *createNullPointer(Type *type); static Value *createConstantVector(const int64_t *constants, Type *type); static Value *createConstantVector(const double *constants, Type *type); - static Value *createConstantPointer(const void *external, Type *type, unsigned int align = 0); static Type *getPointerType(Type *elementType);
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp index 2ed164b..e7d961c 100644 --- a/src/Reactor/Reactor.hpp +++ b/src/Reactor/Reactor.hpp
@@ -2094,7 +2094,6 @@ } Pointer(Argument<Pointer<T>> argument); - explicit Pointer(const void *external); Pointer(); Pointer(RValue<Pointer<T>> rhs); @@ -2475,14 +2474,6 @@ } template<class T> - Pointer<T>::Pointer(const void *external) : alignment((intptr_t)external & 0x0000000F ? 1 : 16) - { - Value *globalPointer = Nucleus::createConstantPointer(external, T::getType(), alignment); - - LValue<Pointer<T>>::storeValue(globalPointer); - } - - template<class T> Pointer<T>::Pointer() : alignment(1) { LValue<Pointer<T>>::storeValue(Nucleus::createNullPointer(T::getType()));
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp index ccebeea..9cb3b70 100644 --- a/src/Reactor/SubzeroReactor.cpp +++ b/src/Reactor/SubzeroReactor.cpp
@@ -1081,18 +1081,6 @@ return result; } - Value *Nucleus::createConstantPointer(const void *address, Type *Ty, unsigned int align) - { - if(sizeof(void*) == 8) - { - return createAssign(::context->getConstantInt64(reinterpret_cast<intptr_t>(address))); - } - else - { - return createAssign(::context->getConstantInt32(reinterpret_cast<intptr_t>(address))); - } - } - Type *Nucleus::getPointerType(Type *ElementType) { if(sizeof(void*) == 8) @@ -1165,14 +1153,7 @@ Value *Nucleus::createNullPointer(Type *Ty) { - if(true) - { - return createNullValue(T(sizeof(void*) == 8 ? Ice::IceType_i64 : Ice::IceType_i32)); - } - else - { - return createConstantPointer(nullptr, Ty); - } + return createNullValue(T(sizeof(void*) == 8 ? Ice::IceType_i64 : Ice::IceType_i32)); } Value *Nucleus::createConstantVector(const int64_t *constants, Type *type)