arch: Include generated decoder header after normal headers
authorAndreas Sandberg <andreas.sandberg@arm.com>
Mon, 27 Feb 2017 12:06:00 +0000 (12:06 +0000)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Mon, 27 Feb 2017 12:06:00 +0000 (12:06 +0000)
The generated decoder header defines macros that represent bit fields
within instructions. These fields typically have short names that
conflict with names in other header files. Include the generated
header after all normal header to avoid this issue.

Change-Id: I53d149b75432c20abdbf651e32c3c785d897973b
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/arch/generic/memhelpers.hh
src/arch/isa_parser.py

index f1c1d33221313cc14f008ed7789a09463311fbc0..a0359a5a76dd2375b935667bc9b7782b7e15b786 100644 (file)
@@ -43,7 +43,9 @@
 #ifndef __ARCH_GENERIC_MEMHELPERS_HH__
 #define __ARCH_GENERIC_MEMHELPERS_HH__
 
+#include "arch/isa_traits.hh"
 #include "base/types.hh"
+#include "mem/packet.hh"
 #include "mem/request.hh"
 #include "sim/byteswap.hh"
 #include "sim/insttracer.hh"
index 8d609ae5ff870b3ebb49db25a9c9bd29ca3387b0..4f9cf2837cb6267af82499d2226e3538feeaeee6 100755 (executable)
@@ -1318,8 +1318,6 @@ class ISAParser(Grammar):
             print >>f, '#if !defined(__SPLIT) || (__SPLIT == 1)'
             self.splits[f] = 1
         # ensure requisite #include's
-        elif filename in ['decoder-g.cc.inc', 'exec-g.cc.inc']:
-            print >>f, '#include "decoder.hh"'
         elif filename == 'decoder-g.hh.inc':
             print >>f, '#include "base/bitfield.hh"'
 
@@ -1360,12 +1358,15 @@ class ISAParser(Grammar):
             f.write('#include "%s"\n' % fn)
             inc.append(fn)
 
+            fn = 'decoder.hh'
+            f.write('#include "%s"\n' % fn)
+            inc.append(fn)
+
             fn = 'decode-method.cc.inc'
             # is guaranteed to have been written for parse to complete
             f.write('#include "%s"\n' % fn)
             inc.append(fn)
 
-            inc.append("decoder.hh")
             print >>dep, file+':', ' '.join(inc)
 
         extn = re.compile('(\.[^\.]+)$')
@@ -1386,6 +1387,10 @@ class ISAParser(Grammar):
                 f.write('#include "%s"\n' % fn)
                 inc.append(fn)
 
+                fn = 'decoder.hh'
+                f.write('#include "%s"\n' % fn)
+                inc.append(fn)
+
                 fn = 'decoder-ns.cc.inc'
                 assert(fn in self.files)
                 print >>f, 'namespace %s {' % self.namespace
@@ -1395,7 +1400,6 @@ class ISAParser(Grammar):
                 print >>f, '}'
                 inc.append(fn)
 
-                inc.append("decoder.hh")
                 print >>dep, file+':', ' '.join(inc)
 
         # instruction execution per-CPU model
@@ -1416,6 +1420,10 @@ class ISAParser(Grammar):
 
                     f.write(cpu.includes+"\n")
 
+                    fn = 'decoder.hh'
+                    f.write('#include "%s"\n' % fn)
+                    inc.append(fn)
+
                     fn = 'exec-ns.cc.inc'
                     assert(fn in self.files)
                     print >>f, 'namespace %s {' % self.namespace