OSDN Git Service

* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
[pf3gnuchains/gcc-fork.git] / gcc / insn-addr.h
1 /* Macros to support INSN_ADDRESSES
2    Copyright (C) 2000 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to the Free
18 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.  */
20
21 #ifndef GCC_INSN_ADDR_H
22 #define GCC_INSN_ADDR_H
23
24 #include "vecprim.h"
25
26 extern VEC(int,heap) *insn_addresses_;
27 extern int insn_current_address;
28
29 #define INSN_ADDRESSES(id) (*&(VEC_address (int, insn_addresses_) [id]))
30 #define INSN_ADDRESSES_ALLOC(size)                      \
31   do                                                    \
32     {                                                   \
33       insn_addresses_ = VEC_alloc (int, heap, size);    \
34       VEC_safe_grow (int, heap, insn_addresses_, size); \
35       memset (VEC_address (int, insn_addresses_),       \
36               0, sizeof (int) * size);                  \
37     }                                                   \
38   while (0)
39 #define INSN_ADDRESSES_FREE() (VEC_free (int, heap, insn_addresses_))
40 #define INSN_ADDRESSES_SET_P() (insn_addresses_ != 0)
41 #define INSN_ADDRESSES_SIZE() (VEC_length (int, insn_addresses_))
42
43 static inline void
44 insn_addresses_new (rtx insn, int insn_addr)
45 {
46   unsigned insn_uid = INSN_UID ((insn));
47
48   if (INSN_ADDRESSES_SET_P ())
49     {
50       size_t size = INSN_ADDRESSES_SIZE ();
51       if (size <= insn_uid)
52         {
53           int *p;
54           VEC_safe_grow (int, heap, insn_addresses_, insn_uid + 1);
55           p = VEC_address (int, insn_addresses_);
56           memset (&p[size],
57                   0, sizeof (int) * (insn_uid + 1 - size));
58         }
59       INSN_ADDRESSES (insn_uid) = insn_addr;
60     }
61 }
62
63 #define INSN_ADDRESSES_NEW(insn, addr)          \
64   (insn_addresses_new (insn, addr))
65
66 #endif /* ! GCC_INSN_ADDR_H */