]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cfgexpand.c
Add generic part for Intel CET enabling. The spec is available at
[thirdparty/gcc.git] / gcc / cfgexpand.c
index a255ac3c6f094c3a0a3b5e4e64c02114a70eeb7b..d0e078214895477a37efd447a37deb599feaa06f 100644 (file)
@@ -2658,12 +2658,28 @@ expand_call_stmt (gcall *stmt)
          }
     }
 
+  rtx_insn *before_call = get_last_insn ();
   lhs = gimple_call_lhs (stmt);
   if (lhs)
     expand_assignment (lhs, exp, false);
   else
     expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
+  /* If the gimple call is an indirect call and has 'nocf_check'
+     attribute find a generated CALL insn to mark it as no
+     control-flow verification is needed.  */
+  if (gimple_call_nocf_check_p (stmt)
+      && !gimple_call_fndecl (stmt))
+    {
+      rtx_insn *last = get_last_insn ();
+      while (!CALL_P (last)
+            && last != before_call)
+       last = PREV_INSN (last);
+
+      if (last != before_call)
+       add_reg_note (last, REG_CALL_NOCF_CHECK, const0_rtx);
+    }
+
   mark_transaction_restart_calls (stmt);
 }