| 134 | #endif |
| 135 | |
| 136 | Optional<ThreadPoolStrategy> |
| 137 | llvm::get_threadpool_strategy(StringRef Num, ThreadPoolStrategy Default) { |
| 138 | if (Num == "all") |
| 139 | return llvm::hardware_concurrency(); |
| 140 | if (Num.empty()) |
| 141 | return Default; |
| 142 | unsigned V; |
| 143 | if (Num.getAsInteger(10, V)) |
| 144 | return None; // malformed 'Num' value |
| 145 | if (V == 0) |
| 146 | return Default; |
| 147 | |
| 148 | // Do not take the Default into account. This effectively disables |
| 149 | // heavyweight_hardware_concurrency() if the user asks for any number of |
| 150 | // threads on the cmd-line. |
| 151 | ThreadPoolStrategy S = llvm::hardware_concurrency(); |
| 152 | S.ThreadsRequested = V; |
| 153 | return S; |
| 154 | } |
nothing calls this directly
no test coverage detected