Commit 4126b8ed by Nicolas Capens Committed by Nicolas Capens

Assume local variables are naturally aligned.

Using alignment = 0 to signify natural alignment will allow to discern between loads/stores for stack variables, and dereferencing generic pointers. Bug swiftshader:78 Change-Id: I6d9c1728fb9858ca57380bc6bfafc7fb2fa5feae Reviewed-on: https://swiftshader-review.googlesource.com/10968Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 1894cfa4
...@@ -89,8 +89,8 @@ namespace sw ...@@ -89,8 +89,8 @@ namespace sw
return false; return false;
} }
Value *loadValue(unsigned int alignment = 0) const; Value *loadValue() const;
Value *storeValue(Value *value, unsigned int alignment = 0) const; Value *storeValue(Value *value) const;
Value *getAddress(Value *index, bool unsignedIndex) const; Value *getAddress(Value *index, bool unsignedIndex) const;
}; };
...@@ -2105,7 +2105,7 @@ namespace sw ...@@ -2105,7 +2105,7 @@ namespace sw
template<class S> template<class S>
Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment) Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment)
{ {
Value *pointerS = pointer.loadValue(alignment); Value *pointerS = pointer.loadValue();
Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType())); Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType()));
LValue<Pointer<T>>::storeValue(pointerT); LValue<Pointer<T>>::storeValue(pointerT);
} }
...@@ -2240,15 +2240,15 @@ namespace sw ...@@ -2240,15 +2240,15 @@ namespace sw
} }
template<class T> template<class T>
Value *LValue<T>::loadValue(unsigned int alignment) const Value *LValue<T>::loadValue() const
{ {
return Nucleus::createLoad(address, T::getType(), false, alignment); return Nucleus::createLoad(address, T::getType(), false, 0);
} }
template<class T> template<class T>
Value *LValue<T>::storeValue(Value *value, unsigned int alignment) const Value *LValue<T>::storeValue(Value *value) const
{ {
return Nucleus::createStore(value, address, T::getType(), false, alignment); return Nucleus::createStore(value, address, T::getType(), false, 0);
} }
template<class T> template<class T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment