2010-07-27 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc/alias-decl.git] / gcc / insn-addr.h
blob0cf292cb10df847670c084f127995d81b3d12edd
1 /* Macros to support INSN_ADDRESSES
2 Copyright (C) 2000, 2007 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 3, 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 COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_INSN_ADDR_H
21 #define GCC_INSN_ADDR_H
23 #include "vecprim.h"
25 extern VEC(int,heap) *insn_addresses_;
26 extern int insn_current_address;
28 #define INSN_ADDRESSES(id) (*&(VEC_address (int, insn_addresses_) [id]))
29 #define INSN_ADDRESSES_ALLOC(size) \
30 do \
31 { \
32 insn_addresses_ = VEC_alloc (int, heap, size); \
33 VEC_safe_grow (int, heap, insn_addresses_, size); \
34 memset (VEC_address (int, insn_addresses_), \
35 0, sizeof (int) * size); \
36 } \
37 while (0)
38 #define INSN_ADDRESSES_FREE() (VEC_free (int, heap, insn_addresses_))
39 #define INSN_ADDRESSES_SET_P() (insn_addresses_ != 0)
40 #define INSN_ADDRESSES_SIZE() (VEC_length (int, insn_addresses_))
42 static inline void
43 insn_addresses_new (rtx insn, int insn_addr)
45 unsigned insn_uid = INSN_UID ((insn));
47 if (INSN_ADDRESSES_SET_P ())
49 size_t size = INSN_ADDRESSES_SIZE ();
50 if (size <= insn_uid)
52 int *p;
53 VEC_safe_grow (int, heap, insn_addresses_, insn_uid + 1);
54 p = VEC_address (int, insn_addresses_);
55 memset (&p[size],
56 0, sizeof (int) * (insn_uid + 1 - size));
58 INSN_ADDRESSES (insn_uid) = insn_addr;
62 #define INSN_ADDRESSES_NEW(insn, addr) \
63 (insn_addresses_new (insn, addr))
65 #endif /* ! GCC_INSN_ADDR_H */