summaryrefslogtreecommitdiff
path: root/gcc/expr-accessor.hpp
blob: bdc43e46aa7a92b9fccb06ff7cc8fdeea120bc44 (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
#pragma once

#include "ipa-prototype.h"
#include "expr-walker.hpp"
#include "type-escaper.hpp"
#include "collect-types.h"
#include "type-accessor.hpp"
#include <tuple>
#include <map>

constexpr unsigned Empty = 0x0u;
constexpr unsigned Read = 0x01u;
constexpr unsigned Write = 0x02u;

typedef std::map<const_tree, unsigned> field_access_map_t;
typedef std::map<const_tree, field_access_map_t> record_field_map_t;

class ExprAccessor : public ExprWalker
{
public:
  ExprAccessor() {};
  void update(const_tree e, unsigned a);
  void print_accesses();
  void add_all_fields_in_struct(const_tree t);
  record_field_map_t get_map() { return record_field_map; };
private:
  unsigned _access;
  record_field_map_t record_field_map;
  virtual void _walk_COMPONENT_REF_pre(const_tree e);
  virtual void _walk_pre(const_tree t);
};