OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [machine/] [xscale/] [machine/] [profile.h] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* profile.h
2
 
3
   Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
4
 
5
   Permission to use, copy, modify, and distribute this software
6
   is freely granted, provided that this notice is preserved.  */
7
 
8
#ifndef __XSCALE_PROFILE_H__
9
#define __XSCALE_PROFILE_H__
10
 
11
/* FIXME:
12
   We need to create a string version of the CPP predefined
13
   __USER_LABEL_PREFIX__ macro.  Ideally we would like to
14
   so do something like:
15
 
16
     #if  __USER_LABEL_PREFIX__ == _
17
 
18
   but this fails for arm-elf targets because although
19
   __USER_LABEL__PREFIX__ is defined, it is not defined to
20
   a specific value (even 0) and so the above test fails
21
   with:
22
 
23
      operator '==' has no left operand
24
 
25
  Instead we have to test the CPP predefined __ELF__ and
26
  rely upon the *assumption* that ELF targets will not use
27
  an underscore prefix and that COFF targets will.  */
28
 
29
#ifdef __ELF__
30
#define FOO ""
31
#else
32
#define FOO "_"
33
#endif
34
 
35
#define _MCOUNT_DECL(frompc, selfpc) \
36
void __attribute__ ((no_instrument_function)) \
37
mcount_internal (frompc, selfpc)
38
 
39
/* mcount_internal expects two arguments
40
   r0 frompc (return address for function that call function that calls mcount)
41
   r1 selfpc (return address for function that called mcount)
42
 
43
   The frompc is extracted from the stack frames. If the code does not
44
   generate stack frames, then mcount cannot extract this
45
   information. Thus, the -fomit-frame-pointer optimization cannot be
46
   used if a call graph information is required.
47
 
48
   Due to optimizations mcount doesn't set up a new fp. mcount has the fp
49
   of the calling function.
50
 
51
   r0 frompc is from the current frame
52
   r1 selfpc can be obtained directly from lr.  */
53
 
54
#ifdef __thumb__
55
#define MCOUNT                                  \
56
void __attribute__ ((naked))                    \
57
     __attribute__ ((no_instrument_function))   \
58
mcount (void)                                   \
59
{                                               \
60
  __asm__("push {r0, r1, r2, r3, lr};"          \
61
          "add r0, r7, #0;"                     \
62
          "beq 1f;"                             \
63
          "sub r0, r0, #4;"                     \
64
          "ldr r0, [r0];"                       \
65
          "1: mov r1, lr;"                      \
66
          "bl " FOO "mcount_internal ;"         \
67
          "pop {r0, r1, r2, r3, pc};"           \
68
        );                                      \
69
}
70
#else
71
#define MCOUNT                                  \
72
void __attribute__ ((naked))                    \
73
     __attribute__ ((no_instrument_function))   \
74
mcount (void)                                   \
75
{                                               \
76
  __asm__("stmdb sp!, {r0, r1, r2, r3, lr};"    \
77
          "movs r0, fp;"                        \
78
          "ldrne r0, [r0, #-4];"                \
79
          "mov r1, lr;"                         \
80
          "bl " FOO "mcount_internal ;"         \
81
          "ldmia sp!, {r0, r1, r2, r3, pc};"    \
82
        );                                      \
83
}
84
#endif
85
 
86
#define FUNCTION_ALIGNMENT 2
87
 
88
#endif /* !__XSCALE_PROFILE_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.