-
Notifications
You must be signed in to change notification settings - Fork 1
/
RangedPointer.h
80 lines (71 loc) · 1.97 KB
/
RangedPointer.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//===--- RangedPointer.h - Pass definition ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief This file contains the declaration of the RangedPointer class for the
/// Ranged Based Alias Analysis
///
//===----------------------------------------------------------------------===//
#ifndef __RANGED_POINTER_H__
#define __RANGED_POINTER_H__
#include <set>
#include <map>
#include <utility>
namespace llvm {
/// Forward declarations
class Value;
class Address;
//class Range;
class Value;
class Use;
class RangeBasedPointerAnalysis;
/// \brief Pointer representation in which each pointer is a set of
/// possible addresses
class RangedPointer
{
friend class Address;
public:
enum PointerTypes
{
Unk = 0,
Alloc = 1,
Phi = 2,
Cont = 3,
Null = 4
};
const Value* Pointer;
std::set<Address*> Addresses;
std::set<Address*> Bases;
PointerTypes PointerType;
int color;
int scc;
RangedPointer* phase1_base;
Range* phase1_offset;
RangedPointer(const Value* pointer);
RangedPointer(const Value* pointer, PointerTypes pointer_type);
RangedPointer(RangedPointer*);
void processGEP(RangedPointer*, const Use*, const Use*);
void processInitialAddresses(RangeBasedPointerAnalysis* analysis);
const Value* getPointer();
void setPointerType(PointerTypes);
enum PointerTypes getPointerType();
std::set<Address*>::iterator addr_begin();
std::set<Address*>::iterator addr_end();
bool addr_empty();
std::set<Address*>::iterator bases_begin();
std::set<Address*>::iterator bases_end();
void print();
bool isEvil();
//function and structures for the local analysis
RangedPointer* LocalTree;
std::map<RangedPointer*, std::pair<int, Range*> > Path;
void getUniquePath();
};
}
#endif