clang: Fix recently introduced clang compilation errors
authorAndreas Hansson <andreas.hansson@arm.com>
Mon, 19 Mar 2012 10:35:04 +0000 (06:35 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Mon, 19 Mar 2012 10:35:04 +0000 (06:35 -0400)
This patch makes the code compile with clang 2.9 and 3.0 again by
making two very minor changes. Firt, it maintains a strict typing in
the forward declaration of the BaseCPUParams. Second, it adds a
FullSystemInt flag of the type unsigned int next to the boolean
FullSystem flag. The FullSystemInt variable can be used in
decode-statements (expands to switch statements) in the instruction
decoder.

src/arch/alpha/isa/decoder.isa
src/arch/mips/isa/decoder.isa
src/arch/x86/isa/decoder/one_byte_opcodes.isa
src/arch/x86/isa/decoder/two_byte_opcodes.isa
src/cpu/base.hh
src/sim/full_system.hh
src/sim/root.cc

index 4bbf83cce3c8289104c2532fe0758427d098fcd5..9785e217c5cc81ba94ba9eb279f5f0df5e04a340 100644 (file)
@@ -805,14 +805,14 @@ decode OPCODE default Unknown::unknown() {
             0x4400: wmb({{ }}, IsWriteBarrier, MemWriteOp);
         }
 
-        0xe000: decode FullSystem {
+        0xe000: decode FullSystemInt {
             0: FailUnimpl::rc_se();
             default: BasicOperate::rc({{
                 Ra = IntrFlag;
                 IntrFlag = 0;
             }}, IsNonSpeculative, IsUnverifiable);
         }
-        0xf000: decode FullSystem {
+        0xf000: decode FullSystemInt {
             0: FailUnimpl::rs_se();
             default: BasicOperate::rs({{
                 Ra = IntrFlag;
@@ -821,7 +821,7 @@ decode OPCODE default Unknown::unknown() {
         }
     }
 
-    0x00: decode FullSystem {
+    0x00: decode FullSystemInt {
         0: decode PALFUNC {
             format EmulatedCallPal {
                 0x00: halt ({{
index 034133f9699c7a5fb4a9ad72bc32e5f278c63174..1091e67a04f62412b94b6ac3c259029263179b2f 100644 (file)
@@ -163,7 +163,7 @@ decode OPCODE_HI default Unknown::unknown() {
                 format BasicOp {
                     0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }});
                     0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }});
-                    0x4: decode FullSystem {
+                    0x4: decode FullSystemInt {
                         0: syscall_se({{ xc->syscall(R2); }},
                                 IsSerializeAfter, IsNonSpeculative);
                         default: syscall({{ fault = new SystemCallFault(); }});
@@ -2431,7 +2431,7 @@ decode OPCODE_HI default Unknown::unknown() {
                     }
                 }
                 0x3: decode OP default FailUnimpl::rdhwr() {
-                    0x0: decode FullSystem {
+                    0x0: decode FullSystemInt {
                         0: decode RD {
                             29: BasicOp::rdhwr_se({{ Rt = TpValue; }});
                         }
index 4ebf23032eb7a869a5a51db83706fe43598472b9..66a0c8c46da65834365c9b1ee3d8ca1aa0315d1c 100644 (file)
                     default: Inst::RET_FAR();
                 }
                 0x4: int3();
-                0x5: decode FullSystem default int_Ib() {
+                0x5: decode FullSystemInt default int_Ib() {
                     0: decode IMMEDIATE {
                         // Really only the LSB matters, but the predecoder
                         // will sign extend it, and there's no easy way to
index 030e36404dd6091fa2894fd2c4cea10d04621343..378d426e3639c40a1d2b8eee3c3306e6fed5f11b 100644 (file)
                         default: Inst::UD2();
                     }
                 }
-                0x05: decode FullSystem {
+                0x05: decode FullSystemInt {
                     0: SyscallInst::syscall('xc->syscall(Rax)',
                             IsSyscall, IsNonSpeculative, IsSerializeAfter);
                     default: decode MODE_MODE {
                 0x1: Inst::RDTSC();
                 0x2: Inst::RDMSR();
                 0x3: rdpmc();
-                0x4: decode FullSystem {
+                0x4: decode FullSystemInt {
                     0: SyscallInst::sysenter('xc->syscall(Rax)',
                             IsSyscall, IsNonSpeculative, IsSerializeAfter);
                     default: sysenter();
index 74bb8dc12423b5718b5d61fd136626e5e5769348..149d26aa35190b5534d7698e3572d0d682110401 100644 (file)
@@ -58,7 +58,7 @@
 #include "sim/full_system.hh"
 #include "sim/insttracer.hh"
 
-class BaseCPUParams;
+struct BaseCPUParams;
 class BranchPred;
 class CheckerCPU;
 class ThreadContext;
index e67fc11a97c917b510e509383be553ff5fea9a8d..18cf34d09c11c4a0e197436725e122dbc554073a 100644 (file)
 #ifndef __SIM_FULL_SYSTEM_HH__
 #define __SIM_FULL_SYSTEM_HH__
 
+/**
+ * The FullSystem variable can be used to determine the current mode
+ * of simulation.
+ */
 extern bool FullSystem;
 
+/**
+ * In addition to the boolean flag we make use of an unsigned int
+ * since the CPU instruction decoder makes use of the variable in
+ * switch statements. A value of 0 signifies syscall emulation, and
+ * any other value full system.
+ */
+extern unsigned int FullSystemInt;
+
 #endif // __SIM_FULL_SYSTEM_HH__
index c47ada30eeddcc4a39bbc1851232c8978f4392c6..2d28499a7f392649d6df0b7c838360158f7ae64d 100644 (file)
@@ -125,6 +125,7 @@ Root::loadState(Checkpoint *cp)
 }
 
 bool FullSystem;
+unsigned int FullSystemInt;
 
 Root *
 RootParams::create()
@@ -136,6 +137,7 @@ RootParams::create()
     created = true;
 
     FullSystem = full_system;
+    FullSystemInt = full_system ? 1 : 0;
 
     return new Root(this);
 }