8 #ifndef IR_SEG_CBAccessPath_H
9 #define IR_SEG_CBAccessPath_H
11 #include <llvm/IR/Value.h>
13 #include "Platform/Arch/CBTypes.h"
14 #include "Utils/ADT/kvec.h"
24 kvec<pp_offset_t> offsets;
27 bool is_base_ptr_from_return;
32 is_base_ptr_from_return =
false;
38 void add_level(Value *base_ptr, pp_offset_t offset,
39 bool is_from_return =
false) {
40 this->base_ptr = base_ptr;
41 offsets.push_back(offset);
42 this->is_base_ptr_from_return = is_from_return;
47 void reset_cur_level(Value *base_ptr, pp_offset_t offset,
48 bool is_from_return =
false) {
49 if (!offsets.empty()) {
50 this->base_ptr = base_ptr;
51 offsets.back() -= offset;
52 this->is_base_ptr_from_return = is_from_return;
57 void reset(Value *base_ptr,
bool is_from_return =
false) {
59 this->base_ptr = base_ptr;
60 this->is_base_ptr_from_return = is_from_return;
66 offsets.push_back(ap.offsets);
67 this->base_ptr = ap.base_ptr;
68 this->is_base_ptr_from_return = ap.is_base_ptr_from_return;
71 int get_depth()
const {
return offsets.size(); }
73 pp_offset_t get_offset(
int idx)
const {
76 return offsets[get_depth() - idx - 1];
79 Value *get_base_ptr()
const {
return base_ptr; }
82 bool is_from_return()
const {
return is_base_ptr_from_return; }