1 /* Copyright (C) 2007-2016 Free Software Foundation, Inc. 2 Contributor: Joern Rennecke <joern.rennecke@embecosm.com> 3 on behalf of Synopsys Inc. 4 5 This file is part of GCC. 6 7 GCC is free software; you can redistribute it and/or modify it under 8 the terms of the GNU General Public License as published by the Free 9 Software Foundation; either version 3, or (at your option) any later 10 version. 11 12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 for more details. 16 17 Under Section 7 of GPL version 3, you are granted additional 18 permissions described in the GCC Runtime Library Exception, version 19 3.1, as published by the Free Software Foundation. 20 21 You should have received a copy of the GNU General Public License and 22 a copy of the GCC Runtime Library Exception along with this program; 23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 <http://www.gnu.org/licenses/>. */ 25 26 #ifndef MACHINE_GMON_H 27 #define MACHINE_GMON_H 28 29 /* We can't fake out own <sys/types.h> header because the newlib / uclibc 30 headers in GCC_FOR_TARGET take precedence. */ 31 32 #define __BEGIN_DECLS 33 #define __END_DECLS 34 35 #define __THROW 36 37 extern int __dcache_linesz (void); 38 39 #define _MCOUNT_DECL(countp, selfpc) \ 40 static inline void _mcount_internal (void *countp, u_long selfpc) 41 42 extern void _mcount (void); 43 extern void _mcount_call (void); 44 45 /* N.B.: the calling point might be a sibcall, thus blink does not necessarily 46 hold the caller's address. r8 doesn't hold the caller's address, either, 47 but rather a pointer to the counter data structure associated with the 48 caller. 49 This function must be compiled with optimization turned on in order to 50 enable a sibcall for the final call to selfpc; this is important when trying 51 to profile a program with deep tail-recursion that would get a stack 52 overflow otherwise. */ 53 #define MCOUNT \ 54 void \ 55 _mcount_call (void) \ 56 { \ 57 register void *countp __asm("r8"); \ 58 register u_long selfpc __asm("r9"); \ 59 _mcount_internal (countp, selfpc); \ 60 ((void (*)(void)) selfpc) (); \ 61 } 62 63 extern int __profil (u_short *,size_t, size_t, u_int); 64 65 #endif /* MACHINE_GMON_H */ 66