summaryrefslogtreecommitdiff
path: root/gcc/type-reconstructor.hpp
blob: 12260f9a48bc3d58b4301902a7751ecd3fcc9111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <set>
#include <map>
#include <stack>
#include <vector>

#include "type-walker.hpp"

class TypeReconstructor : public TypeWalker
{
public:
  typedef std::map<const_tree, const_tree> reorg_record_map_t;
private:
  typedef std::set<unsigned> field_offsets_t;
  typedef std::map<const_tree, field_offsets_t> record_field_offset_map_t;
  typedef std::stack<bool> field_stack_t;
  typedef std::stack<field_offsets_t> record_stack_t;
  typedef std::stack<const_tree> type_stack_t;
  typedef std::vector<const_tree> type_vector_t;
  typedef std::stack<type_vector_t> type_vector_stack_t;
  typedef std::stack<bool> bool_stack_t;
  record_field_offset_map_t _records;
  reorg_record_map_t _reorg_map;
  field_stack_t _field_stack;
  record_stack_t _record_stack;
  type_stack_t _working_stack;
  type_vector_stack_t _field_decls;
  type_vector_stack_t _eliminated_fields;
  bool_stack_t _modifying;

  virtual void _walk_field_pre(const_tree);
  virtual void _walk_field_post(const_tree);
  virtual void _walk_RECORD_TYPE_pre(const_tree);
  virtual void _walk_RECORD_TYPE_post(const_tree);
  virtual void _walk_ARRAY_TYPE_pre(const_tree);
  virtual void _walk_ARRAY_TYPE_post(const_tree);
  virtual void _walk_POINTER_TYPE_pre(const_tree);
  virtual void _walk_POINTER_TYPE_post(const_tree);
public:
  virtual bool is_memoized(const_tree t);
  TypeReconstructor(record_field_offset_map_t records) : _records(records) {};
  reorg_record_map_t get_map() { return _reorg_map; };
};