diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2017-08-22 16:19:32 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2017-08-22 16:19:32 +0200 |
commit | 696bd9d2906e79bdfa11bc18e4b2de0521f6e996 (patch) | |
tree | 26a0d98d26ccd3bffa121eed5ea89f6e3de49c72 | |
parent | 0f41d864e06409a55976b3a69ab5deb127def42a (diff) | |
download | compcert-696bd9d2906e79bdfa11bc18e4b2de0521f6e996.tar.gz compcert-696bd9d2906e79bdfa11bc18e4b2de0521f6e996.zip |
ARM in Thumb mode: simpler instruction sequence for Pbtbl pseudo, continued
A 16-bit "nop" is needed because in "add pc, r14" pc reads as the address of the add instruction plus 4, and "add pc, r14" has a 16-bit encoding.
-rw-r--r-- | arm/TargetPrinter.ml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arm/TargetPrinter.ml b/arm/TargetPrinter.ml index b95a600b..89215f71 100644 --- a/arm/TargetPrinter.ml +++ b/arm/TargetPrinter.ml @@ -706,7 +706,8 @@ struct | Pbtbl(r, tbl) -> if !Clflags.option_mthumb then begin fprintf oc " lsl r14, %a, #2\n" ireg r; - fprintf oc " add pc, r14\n"; + fprintf oc " add pc, r14\n"; (* 16-bit encoding *) + fprintf oc " nop\n"; (* 16-bit encoding *) List.iter (fun l -> fprintf oc " b.w %a\n" print_label l) tbl; |