| 10 | namespace ftg { |
| 11 | |
| 12 | class RDNode { |
| 13 | public: |
| 14 | RDNode(int OpIdx, llvm::Instruction &I, const RDNode *Before = nullptr); |
| 15 | RDNode(llvm::Value &V, llvm::Instruction &I, const RDNode *Before = nullptr); |
| 16 | RDNode(const RDTarget &Target, llvm::Instruction &I, |
| 17 | const RDNode *Before = nullptr); |
| 18 | RDNode(const RDNode &Src); |
| 19 | |
| 20 | void copyVisit(const RDNode &Src); |
| 21 | void setIdx(int Idx); |
| 22 | void setTarget(llvm::Value &V); |
| 23 | void setLocation(llvm::Instruction &I); |
| 24 | void setFirstUses(const std::set<RDArgIndex> &FirstUses); |
| 25 | void setFirstUse(llvm::CallBase &CB, int ArgNo); |
| 26 | void setForcedDef(); |
| 27 | void setStopTracing(bool Flag); |
| 28 | void timeout(); |
| 29 | |
| 30 | void visit(const RDTarget &T, const llvm::Instruction &I); |
| 31 | void addFirstUse(llvm::CallBase &CB, int ArgNo); |
| 32 | void addFirstUse(const RDArgIndex &Src); |
| 33 | void addFirstUses(const std::set<RDArgIndex> &FirstUses); |
| 34 | |
| 35 | void cancelVisit(llvm::Function &F); |
| 36 | void clearVisit(); |
| 37 | void eraseEmptyFirstUse(); |
| 38 | void clearFirstUses(); |
| 39 | |
| 40 | int getIdx() const; |
| 41 | const RDTarget &getTarget() const; |
| 42 | llvm::Instruction &getLocation(); |
| 43 | const std::set<RDArgIndex> &getFirstUses() const; |
| 44 | std::pair<llvm::Value *, int> getDefinition() const; |
| 45 | |
| 46 | bool isVisit(const RDTarget &T, const llvm::Instruction &I) const; |
| 47 | bool isVisit(const llvm::Function &F) const; |
| 48 | bool isRootDefinition() const; |
| 49 | bool isMemory() const; |
| 50 | bool isTimeout() const; |
| 51 | bool isStopTracing() const; |
| 52 | |
| 53 | RDNode &operator=(const RDNode &RHS); |
| 54 | bool operator<(const RDNode &Src) const; |
| 55 | bool operator==(const RDNode &Src) const; |
| 56 | friend llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const RDNode &Src); |
| 57 | |
| 58 | private: |
| 59 | struct RDVisitNode { |
| 60 | const std::shared_ptr<const RDTarget> T; |
| 61 | const llvm::Instruction &I; |
| 62 | RDVisitNode(const RDTarget &T, const llvm::Instruction &I); |
| 63 | bool operator<(const RDVisitNode &Rhs) const; |
| 64 | }; |
| 65 | int Idx; |
| 66 | std::shared_ptr<RDTarget> Target; |
| 67 | llvm::Instruction *Location; |
| 68 | std::map<const llvm::Function *, std::set<RDVisitNode>> Visit; |
| 69 | std::set<RDArgIndex> FirstUses; |
no outgoing calls