gcc/ChangeLog ---------------------------------------------------------
[official-gcc.git] / gcc / insn-addr.h
blobbaa3cdadcae567422125945e0828c00b153f7549
1 /* Macros to support INSN_ADDRESSES
2 Copyright (C) 2000 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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. */
21 #ifndef GCC_INSN_ADDR_H
22 #define GCC_INSN_ADDR_H
24 #include "vecprim.h"
26 extern VEC(int,heap) *insn_addresses_;
27 extern int insn_current_address;
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_))
43 static inline void
44 insn_addresses_new (rtx insn, int insn_addr)
46 unsigned insn_uid = INSN_UID ((insn));
48 if (INSN_ADDRESSES_SET_P ())
50 size_t size = INSN_ADDRESSES_SIZE ();
51 if (size <= insn_uid)
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));
59 INSN_ADDRESSES (insn_uid) = insn_addr;
63 #define INSN_ADDRESSES_NEW(insn, addr) \
64 (insn_addresses_new (insn, addr))
66 #endif /* ! GCC_INSN_ADDR_H */