PR rtl-optimization/60601
[official-gcc.git] / gcc / insn-addr.h
blobaec09fd102ca95b5b494ab92b1ed6a3dd0a054de
1 /* Macros to support INSN_ADDRESSES
2 Copyright (C) 2000-2014 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 extern vec<int> insn_addresses_;
24 extern int insn_current_address;
26 #define INSN_ADDRESSES(id) (insn_addresses_[id])
27 #define INSN_ADDRESSES_ALLOC(size) \
28 do \
29 { \
30 insn_addresses_.create (size); \
31 insn_addresses_.safe_grow_cleared (size); \
32 memset (insn_addresses_.address (), \
33 0, sizeof (int) * size); \
34 } \
35 while (0)
36 #define INSN_ADDRESSES_FREE() (insn_addresses_.release ())
37 #define INSN_ADDRESSES_SET_P() (insn_addresses_.exists ())
38 #define INSN_ADDRESSES_SIZE() (insn_addresses_.length ())
40 static inline void
41 insn_addresses_new (rtx insn, int insn_addr)
43 unsigned insn_uid = INSN_UID ((insn));
45 if (INSN_ADDRESSES_SET_P ())
47 size_t size = INSN_ADDRESSES_SIZE ();
48 if (size <= insn_uid)
50 int *p;
51 insn_addresses_.safe_grow (insn_uid + 1);
52 p = insn_addresses_.address ();
53 memset (&p[size],
54 0, sizeof (int) * (insn_uid + 1 - size));
56 INSN_ADDRESSES (insn_uid) = insn_addr;
60 #define INSN_ADDRESSES_NEW(insn, addr) \
61 (insn_addresses_new (insn, addr))
63 #endif /* ! GCC_INSN_ADDR_H */