machine-gmon.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Machine-specific calling sequence for `mcount' profiling function. MIPS
  2. Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 1)
  17. #define _MCOUNT_DECL(frompc,selfpc) \
  18. static void __mcount (u_long frompc, u_long selfpc)
  19. #else
  20. #define _MCOUNT_DECL(frompc,selfpc) \
  21. static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
  22. #endif
  23. /* Call __mcount with our the return PC for our caller,
  24. and the return PC our caller will return to. */
  25. #ifdef __PIC__
  26. #define CPLOAD ".cpload $25;"
  27. #define CPRESTORE ".cprestore 44\n\t"
  28. #else
  29. #define CPLOAD
  30. #define CPRESTORE
  31. #endif
  32. #define MCOUNT asm(\
  33. ".globl _mcount;\n\t" \
  34. ".align 2;\n\t" \
  35. ".type _mcount,@function;\n\t" \
  36. ".ent _mcount\n\t" \
  37. "_mcount:\n\t" \
  38. ".frame $sp,44,$31\n\t" \
  39. ".set noreorder;\n\t" \
  40. ".set noat;\n\t" \
  41. CPLOAD \
  42. "subu $29,$29,48;\n\t" \
  43. CPRESTORE \
  44. "sw $4,24($29);\n\t" \
  45. "sw $5,28($29);\n\t" \
  46. "sw $6,32($29);\n\t" \
  47. "sw $7,36($29);\n\t" \
  48. "sw $2,40($29);\n\t" \
  49. "sw $1,16($29);\n\t" \
  50. "sw $31,20($29);\n\t" \
  51. "move $5,$31;\n\t" \
  52. "move $4,$1;\n\t" \
  53. "jal __mcount;\n\t" \
  54. "nop;\n\t" \
  55. "lw $4,24($29);\n\t" \
  56. "lw $5,28($29);\n\t" \
  57. "lw $6,32($29);\n\t" \
  58. "lw $7,36($29);\n\t" \
  59. "lw $2,40($29);\n\t" \
  60. "lw $31,20($29);\n\t" \
  61. "lw $1,16($29);\n\t" \
  62. "addu $29,$29,56;\n\t" \
  63. "j $31;\n\t" \
  64. "move $31,$1;\n\t" \
  65. ".set reorder;\n\t" \
  66. ".set at\n\t" \
  67. ".end _mcount");