[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 8c97086..a2a7151 100644 (file)
@@ -1,5 +1,10 @@
 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
        type and 32-bit size.
 
index 3ac0718..42a1c12 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.  */