OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [streamer-hooks.h] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 684 jeremybenn
/* Streamer hooks.  Support for adding streamer-specific callbacks to
2
   generic streaming routines.
3
 
4
   Copyright 2011 Free Software Foundation, Inc.
5
   Contributed by Diego Novillo <dnovillo@google.com>
6
 
7
This file is part of GCC.
8
 
9
GCC is free software; you can redistribute it and/or modify it under
10
the terms of the GNU General Public License as published by the Free
11
Software Foundation; either version 3, or (at your option) any later
12
version.
13
 
14
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15
WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17
for more details.
18
 
19
You should have received a copy of the GNU General Public License
20
along with GCC; see the file COPYING3.  If not see
21
<http://www.gnu.org/licenses/>.  */
22
 
23
#ifndef GCC_STREAMER_HOOKS_H
24
#define GCC_STREAMER_HOOKS_H
25
 
26
#include "tree.h"
27
 
28
/* Forward declarations to avoid including unnecessary headers.  */
29
struct output_block;
30
struct lto_input_block;
31
struct data_in;
32
 
33
/* Streamer hooks.  These functions do additional processing as
34
   needed by the module.  There are two types of callbacks, those that
35
   replace the default behavior and those that supplement it.
36
 
37
   Hooks marked [REQ] are required to be set.  Those marked [OPT] may
38
   be NULL, if the streamer does not need to implement them.  */
39
struct streamer_hooks {
40
  /* [REQ] Called by every tree streaming routine that needs to write
41
     a tree node.  The arguments are: output_block where to write the
42
     node, the tree node to write and a boolean flag that should be true
43
     if the caller wants to write a reference to the tree, instead of the
44
     tree itself.  The second boolean parameter specifies this for
45
     the tree itself, the first for all siblings that are streamed.
46
     The referencing mechanism is up to each streamer to implement.  */
47
  void (*write_tree) (struct output_block *, tree, bool, bool);
48
 
49
  /* [REQ] Called by every tree streaming routine that needs to read
50
     a tree node.  It takes two arguments: an lto_input_block pointing
51
     to the buffer where to read from and a data_in instance with tables
52
     and descriptors needed by the unpickling routines.  It returns the
53
     tree instantiated from the stream.  */
54
  tree (*read_tree) (struct lto_input_block *, struct data_in *);
55
 
56
  /* [OPT] Called by lto_input_location to retrieve the source location of the
57
     tree currently being read. If this hook returns NULL, lto_input_location
58
     defaults to calling lto_input_location_bitpack.  */
59
  location_t (*input_location) (struct lto_input_block *, struct data_in *);
60
 
61
  /* [OPT] Called by lto_output_location to write the source_location of the
62
     tree currently being written. If this hook returns NULL,
63
     lto_output_location defaults to calling lto_output_location_bitpack.  */
64
  void (*output_location) (struct output_block *, location_t);
65
};
66
 
67
#define stream_write_tree(OB, EXPR, REF_P) \
68
    streamer_hooks.write_tree(OB, EXPR, REF_P, REF_P)
69
 
70
#define stream_write_tree_shallow_non_ref(OB, EXPR, REF_P) \
71
    streamer_hooks.write_tree(OB, EXPR, REF_P, false)
72
 
73
#define stream_read_tree(IB, DATA_IN) \
74
    streamer_hooks.read_tree(IB, DATA_IN)
75
 
76
/* Streamer hooks.  */
77
extern struct streamer_hooks streamer_hooks;
78
 
79
/* In streamer-hooks.c.  */
80
void streamer_hooks_init (void);
81
 
82
#endif  /* GCC_STREAMER_HOOKS_H  */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.