[NDS32] Implement PROFILE_HOOK.
authorChung-Ju Wu <jasonwucj@gmail.com>
Sun, 1 Apr 2018 08:52:24 +0000 (08:52 +0000)
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>
Sun, 1 Apr 2018 08:52:24 +0000 (08:52 +0000)
gcc/
* config/nds32/nds32.h (FUNCTION_PROFILER): Output newline character.
(PROFILE_HOOK): Define its implementation.

From-SVN: r258996

gcc/ChangeLog
gcc/config/nds32/nds32.h

index 8c97086a31983a2bee28b22d585fcd4fb2c6c9ba..a2a7151b72639877fa7cb809fa0da76014efd176 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-01  Chung-Ju Wu  <jasonwucj@gmail.com>
+
+       * config/nds32/nds32.h (FUNCTION_PROFILER): Output newline character.
+       (PROFILE_HOOK): Define its implementation.
+
 2018-04-01  Chung-Ju Wu  <jasonwucj@gmail.com>
 
        * config/nds32/nds32.h (WCHAR_TYPE, WCHAR_TYPE_SIZE): Use unsigned int
index 3ac071872b9f4b6e4385ff9ed89e169db79c8826..42a1c1296a500a744523243b6cd3b7e72bb5d53d 100644 (file)
@@ -801,7 +801,15 @@ enum reg_class
 #define EXIT_IGNORE_STACK 1
 
 #define FUNCTION_PROFILER(file, labelno) \
-  fprintf (file, "/* profiler %d */", (labelno))
+  fprintf (file, "/* profiler %d */\n", (labelno))
+
+#define PROFILE_HOOK(LABEL)                                            \
+  {                                                                    \
+    rtx fun, lp;                                                       \
+    lp = get_hard_reg_initial_val (Pmode, LP_REGNUM);                  \
+    fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount");                       \
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, lp, Pmode);          \
+  }
 
 \f
 /* Implementing the Varargs Macros.  */