| 1301 | } |
| 1302 | |
| 1303 | std::vector<llvm::Value*> LLVMGenerator::Visitor::BuildParams( |
| 1304 | int holder_idx, const ValueValidityPairVector& args, bool with_validity, |
| 1305 | bool with_context) { |
| 1306 | std::vector<llvm::Value*> params; |
| 1307 | |
| 1308 | // add context if required. |
| 1309 | if (with_context) { |
| 1310 | params.push_back(arg_context_ptr_); |
| 1311 | } |
| 1312 | |
| 1313 | // if the function has holder, add the holder pointer. |
| 1314 | if (holder_idx != -1) { |
| 1315 | auto builder = ir_builder(); |
| 1316 | |
| 1317 | // Switch to the entry block and load the holder pointers |
| 1318 | llvm::BasicBlock* saved_block = builder->GetInsertBlock(); |
| 1319 | builder->SetInsertPoint(entry_block_); |
| 1320 | |
| 1321 | auto holder = generator_->LoadVectorAtIndex( |
| 1322 | arg_holder_ptrs_, generator_->types()->i64_type(), holder_idx, "holder"); |
| 1323 | |
| 1324 | builder->SetInsertPoint(saved_block); |
| 1325 | params.push_back(holder); |
| 1326 | } |
| 1327 | |
| 1328 | // build the function params, along with the validities. |
| 1329 | for (auto& pair : args) { |
| 1330 | // build value. |
| 1331 | DexPtr value_expr = pair->value_expr(); |
| 1332 | value_expr->Accept(*this); |
| 1333 | LValue& result_ref = *result(); |
| 1334 | |
| 1335 | // append all the parameters corresponding to this LValue. |
| 1336 | result_ref.AppendFunctionParams(¶ms); |
| 1337 | |
| 1338 | // build validity. |
| 1339 | if (with_validity) { |
| 1340 | llvm::Value* validity_expr = BuildCombinedValidity(pair->validity_exprs()); |
| 1341 | params.push_back(validity_expr); |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | return params; |
| 1346 | } |
| 1347 | |
| 1348 | // Bitwise-AND of a vector of bits to get the combined validity. |
| 1349 | llvm::Value* LLVMGenerator::Visitor::BuildCombinedValidity(const DexVector& validities) { |
nothing calls this directly
no test coverage detected