| 151 | const std::set<RDArgIndex> &RDNode::getFirstUses() const { return FirstUses; } |
| 152 | |
| 153 | std::pair<Value *, int> RDNode::getDefinition() const { |
| 154 | |
| 155 | assert(Target && Location && "Unexpected Program State"); |
| 156 | |
| 157 | if (isa<CallBase>(Location) && Idx >= 0) { |
| 158 | return std::make_pair(Location, Idx); |
| 159 | } |
| 160 | |
| 161 | assert(Target && "Unexpected Program State"); |
| 162 | auto &IR = Target->getIR(); |
| 163 | |
| 164 | if (isa<Constant>(&IR)) { |
| 165 | if (auto *GV = dyn_cast_or_null<GlobalVariable>(&IR)) { |
| 166 | if (!GV->hasAtLeastLocalUnnamedAddr()) |
| 167 | return std::make_pair(&IR, -1); |
| 168 | } |
| 169 | return std::make_pair(Location, -1); |
| 170 | } |
| 171 | return std::make_pair(&IR, -1); |
| 172 | } |
| 173 | |
| 174 | bool RDNode::isVisit(const RDTarget &T, const Instruction &I) const { |
| 175 | const auto *F = I.getFunction(); |
no outgoing calls