swap #ifdef USING_NOREGS so that it is possible to redefine set_pc
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Oct 2018 08:09:21 +0000 (09:09 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Oct 2018 08:09:21 +0000 (09:09 +0100)
to avoid having to modify the branch instructions the set_pc macro will
be #undefd and redefined to modify the predication target

riscv/insn_template_sv.cc

index db0525355727fa7df71aabac5ab3e55bf0ad8e54..9869707f2bfcfd8f531e49bfcc8f2c17ebfa237f 100644 (file)
@@ -13,7 +13,10 @@ reg_t FN(processor_t* p, insn_t s_insn, reg_t pc)
   // and create an sv-variant.  also an opportunity to pass
   // in a stack of other things that are needed.
   insn_bits_t bits = s_insn.bits();
-#ifndef USING_NOREGS
+#ifdef USING_NOREGS
+  insn_t insn(bits);
+  #include INCLUDEFILE
+#else
   int vlen = 0;
   if (p->get_state()->prv == 0) { // XXX HACK - disable in supervisor mode
     vlen = p->get_state()->vl;
@@ -173,9 +176,6 @@ reg_t FN(processor_t* p, insn_t s_insn, reg_t pc)
 #ifdef INSN_CATEGORY_TWINPREDICATION
   *src_offs = 0;
 #endif
-#else
-  insn_t insn(bits);
-  #include INCLUDEFILE
 #endif
   trace_opcode(p, INSNCODE, insn);
   return npc;