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