On 10/17/22 23:48, Peter Maydell wrote:
-    if (use_goto_tb(s, dest)) {
-        tcg_gen_goto_tb(n);
-        gen_a64_update_pc(s, diff);
+    if (use_goto_tb(s, s->pc_curr + diff)) {
+        if (TARGET_TB_PCREL) {
+            gen_a64_update_pc(s, diff);
+            tcg_gen_goto_tb(n);
+        } else {
+            tcg_gen_goto_tb(n);
+            gen_a64_update_pc(s, diff);
+        }

Why do we need to do these things in the opposite order
depending on TARGET_TB_PCREL ? If there's an obscure dependency
then it would be worth commenting it, but it would be nicer
if the semantics of the functions were such that they didn't
need to be called the opposite way round for the two cases...

For !pcrel, we can skip the update to pc in the linked case because the destination knows the full virtual address and can easily store it when needed. So we skip the update when we can simply to reduce the dynamic instruction count within the TB.

But for pcrel, the destination cannot easily update, i.e. with just addition, the full virtual address without it always being up-to-date on entry. So that's the rule there.

A comment, then?



r~

Reply via email to