OSDN Git Service

Assume local variables are naturally aligned.
authorNicolas Capens <capn@google.com>
Wed, 26 Jul 2017 17:34:36 +0000 (13:34 -0400)
committerNicolas Capens <nicolascapens@google.com>
Tue, 1 Aug 2017 17:54:05 +0000 (17:54 +0000)
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/10968
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/Reactor/Reactor.hpp

index 98eb6fd..62d9397 100644 (file)
@@ -89,8 +89,8 @@ namespace sw
                        return false;
                }
 
-               Value *loadValue(unsigned int alignment = 0) const;
-               Value *storeValue(Value *value, unsigned int alignment = 0) const;
+               Value *loadValue() const;
+               Value *storeValue(Value *value) const;
                Value *getAddress(Value *index, bool unsignedIndex) const;
        };
 
@@ -2105,7 +2105,7 @@ namespace sw
                template<class S>
                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()));
                        LValue<Pointer<T>>::storeValue(pointerT);
                }
@@ -2240,15 +2240,15 @@ namespace sw
        }
 
        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>
-       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>