arm: Mark v7 cbz instructions as direct branches
authorMitch Hayenga <mitch.hayenga@arm.com>
Wed, 3 Sep 2014 11:42:40 +0000 (07:42 -0400)
committerMitch Hayenga <mitch.hayenga@arm.com>
Wed, 3 Sep 2014 11:42:40 +0000 (07:42 -0400)
v7 cbz/cbnz instructions were improperly marked as indirect branches.

src/arch/arm/isa/insts/branch.isa
src/arch/arm/isa/templates/branch.isa

index 3ee9d88e4ee06dc7d04a739bb4d1e6a90404af21..47fd4e8058ba169dee2770c155f90406d8ad92cf 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode:c++ -*-
 
-// Copyright (c) 2010-2012 ARM Limited
+// Copyright (c) 2010-2012, 2014 ARM Limited
 // All rights reserved
 //
 // The license below extends only to copyright in the software and shall
@@ -174,12 +174,15 @@ let {{
     #CBNZ, CBZ. These are always unconditional as far as predicates
     for (mnem, test) in (("cbz", "=="), ("cbnz", "!=")):
         code = 'NPC = (uint32_t)(PC + imm);\n'
+        br_tgt_code = '''pcs.instNPC((uint32_t)(branchPC.instPC() + imm));'''
         predTest = "Op1 %(test)s 0" % {"test": test}
         iop = InstObjParams(mnem, mnem.capitalize(), "BranchImmReg",
-                            {"code": code, "predicate_test": predTest},
-                            ["IsIndirectControl"])
+                            {"code": code, "predicate_test": predTest,
+                            "brTgtCode" : br_tgt_code},
+                            ["IsDirectControl"])
         header_output += BranchImmRegDeclare.subst(iop)
-        decoder_output += BranchImmRegConstructor.subst(iop)
+        decoder_output += BranchImmRegConstructor.subst(iop) + \
+                          BranchTarget.subst(iop)
         exec_output += PredOpExecute.subst(iop)
 
     #TBB, TBH
index c8efdb7a6a447f156c6fafa01aedd88982a4d70e..92c566726ff61a190565250b636524a5492c461c 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode:c++ -*-
 
-// Copyright (c) 2010 ARM Limited
+// Copyright (c) 2010, 2014 ARM Limited
 // All rights reserved
 //
 // The license below extends only to copyright in the software and shall
@@ -212,6 +212,10 @@ class %(class_name)s : public %(base_class)s
         %(class_name)s(ExtMachInst machInst,
                        int32_t imm, IntRegIndex _op1);
         %(BasicExecDeclare)s
+        ArmISA::PCState branchTarget(const ArmISA::PCState &branchPC) const;
+
+        /// Explicitly import the otherwise hidden branchTarget
+        using StaticInst::branchTarget;
 };
 }};