arch: get rid of dummy var init
authorSteve Reinhardt <steve.reinhardt@amd.com>
Sun, 7 Feb 2016 01:21:20 +0000 (17:21 -0800)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Sun, 7 Feb 2016 01:21:20 +0000 (17:21 -0800)
MemOperand variables were being initialized to 0
"to avoid 'uninitialized variable' errors" but these
no longer seem to be a problem (with the exception of
one use case in POWER that is arguably broken and
easily fixed here).

Getting rid of the initialization is necessary to
set up a subsequent patch which extends memory
operands to possibly not be scalars, making the
'= 0' initialization no longer feasible.

src/arch/isa_parser.py
src/arch/power/isa/decoder.isa

index 20df0a7dbc2ab58b34d78929989139932c6deca1..cbc8651d15d90bf1a2de5ea6509ca629545c5eab 100755 (executable)
@@ -790,10 +790,8 @@ class MemOperand(Operand):
         return ''
 
     def makeDecl(self):
-        # Note that initializations in the declarations are solely
-        # to avoid 'uninitialized variable' errors from the compiler.
         # Declare memory data variable.
-        return '%s %s = 0;\n' % (self.ctype, self.base_name)
+        return '%s %s;\n' % (self.ctype, self.base_name)
 
     def makeRead(self, predRead):
         if self.read_code != None:
index 11d22239029b6c3aff1e7abe593f5a2de7c285f2..30002fe336eb4c02e5bdc91eea5124bbdcfe877d 100644 (file)
@@ -309,10 +309,10 @@ decode OPCODE default Unknown::unknown() {
             151: stwx({{ Mem = Rs; }});
             150: stwcx({{
                 bool store_performed = false;
+                Mem = Rs;
                 if (Rsv) {
                     if (RsvLen == 4) {
                         if (RsvAddr == EA) {
-                            Mem = Rs;
                             store_performed = true;
                         }
                     }