| 59 | } |
| 60 | |
| 61 | void DirectionAnalyzer::analyzeDirection(llvm::Argument &A) { |
| 62 | |
| 63 | std::set<Value *> VisitedNodes; |
| 64 | |
| 65 | ArgFlow &AF = getOrCreateArgFlow(A); |
| 66 | |
| 67 | if (auto *T = A.getType()) { |
| 68 | if (!T->isPointerTy()) { |
| 69 | AF |= Dir_In; |
| 70 | return; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // DefUseChanins used as stack, |
| 75 | // StackFrame includes the value(Argument/Field) need to tracking, |
| 76 | // and ArgFlow for which analysis result will be updated. |
| 77 | std::stack<StackFrame> DefUseChains; |
| 78 | DefUseChains.emplace(&A, AF); |
| 79 | |
| 80 | while (!DefUseChains.empty()) { |
| 81 | auto Frame = DefUseChains.top(); |
| 82 | DefUseChains.pop(); |
| 83 | handleStackFrame(Frame, DefUseChains, VisitedNodes); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void DirectionAnalyzer::handleStackFrame(StackFrame &Frame, |
| 88 | std::stack<StackFrame> &DefUseChains, |