; CPUCFG independently, so we use bit flags to specify them.
TargetVariable
HOST_WIDE_INT la_isa_evolution = 0
+
+mannotate-tablejump
+Target Mask(ANNOTATE_TABLEJUMP) Save
+Annotate table jump instruction (jr {reg}) to correlate it with the jump table.
DONE;
})
+(define_mode_attr mode_size [(DI "8") (SI "4")])
+
(define_insn "@tablejump<mode>"
[(set (pc)
(match_operand:P 0 "register_operand" "e"))
(use (label_ref (match_operand 1 "" "")))]
""
- "jr\t%0"
+ {
+ return TARGET_ANNOTATE_TABLEJUMP
+ ? "1:jr\t%0\n\t"
+ ".pushsection\t.discard.tablejump_annotate\n\t"
+ "\t.<mode_size>byte\t1b\n\t"
+ "\t.<mode_size>byte\t%1\n\t"
+ ".popsection"
+ : "jr\t%0";
+ }
[(set_attr "type" "jump")
(set_attr "mode" "none")])
TargetVariable
HOST_WIDE_INT la_isa_evolution = 0
+mannotate-tablejump
+Target Mask(ANNOTATE_TABLEJUMP) Save
+Annotate table jump instruction (jr {reg}) to correlate it with the jump table
+
mfrecipe
Target Mask(ISA_FRECIPE) Var(la_isa_evolution)
Support frecipe.{s/d} and frsqrte.{s/d} instructions.
-mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as
-mrecip -mrecip=@var{opt} -mfrecipe -mno-frecipe -mdiv32 -mno-div32
-mlam-bh -mno-lam-bh -mlamcas -mno-lamcas -mld-seq-sa -mno-ld-seq-sa
--mtls-dialect=@var{opt}}
+-mtls-dialect=@var{opt} -mannotate-tablejump -mno-annotate-tablejump}
@emph{M32R/D Options}
@gccoptlist{-m32r2 -m32rx -m32r
This option controls which tls dialect may be used for general dynamic and
local dynamic TLS models.
+@opindex mannotate-tablejump
+@opindex mno-annotate-tablejump
+@item -mannotate-tablejump
+@itemx -mno-annotate-tablejump
+Create an annotation section @code{.discard.tablejump_annotate} to
+correlate the @code{jirl} instruction and the jump table when a jump
+table is used to optimize the @code{switch} statement. Some external
+tools, for example @file{objtool} of the Linux kernel building system,
+need the annotation to analysis the control flow. The default is
+@option{-mno-annotate-tablejump}.
+
@table @samp
@item trad
Use traditional TLS. This is the default.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-mannotate-tablejump" } */
+
+extern void asdf(int);
+void foo(int x) {
+ switch (x) {
+ case 0: asdf(10); break;
+ case 1: asdf(11); break;
+ case 2: asdf(12); break;
+ case 3: asdf(13); break;
+ case 4: asdf(14); break;
+ }
+}
+
+/* { dg-final { scan-assembler "\\.discard\\.tablejump_annotate" } } */