| 789 | } |
| 790 | |
| 791 | std::set<size_t> RDAnalyzer::getOutParamIndices(CallBase &CB) const { |
| 792 | std::set<size_t> Result; |
| 793 | |
| 794 | // 1. Checks program states. |
| 795 | auto *F = CB.getCalledFunction(); |
| 796 | assert((F && F->isDeclaration()) && "Unexpected Program State"); |
| 797 | |
| 798 | // 2. Checks this call has sret attribute. |
| 799 | unsigned S = 0; |
| 800 | bool HasStructRet = CB.hasStructRetAttr(); |
| 801 | if (HasStructRet) { |
| 802 | Result.insert(0); |
| 803 | S = 1; |
| 804 | } |
| 805 | |
| 806 | // 3. Collect parameter indices whose direction is output. |
| 807 | for (auto E = CB.getNumArgOperands(); S < E; ++S) { |
| 808 | if (isOutParam(CB, S)) |
| 809 | Result.insert(S); |
| 810 | } |
| 811 | return Result; |
| 812 | } |
| 813 | |
| 814 | std::set<unsigned> RDAnalyzer::getNonOutParamIndices(const CallBase &CB) const { |
| 815 |
nothing calls this directly
no test coverage detected