| 567 | } |
| 568 | |
| 569 | Status HdfsScanner::CodegenWriteAlignedTuples(const HdfsScanPlanNode* node, |
| 570 | FragmentState* state, llvm::Function* write_complete_tuple_fn, |
| 571 | llvm::Function** write_aligned_tuples_fn) { |
| 572 | LlvmCodeGen* codegen = state->codegen(); |
| 573 | *write_aligned_tuples_fn = NULL; |
| 574 | DCHECK(write_complete_tuple_fn != NULL); |
| 575 | |
| 576 | llvm::Function* write_tuples_fn = |
| 577 | codegen->GetFunction(IRFunction::HDFS_SCANNER_WRITE_ALIGNED_TUPLES, true); |
| 578 | DCHECK(write_tuples_fn != NULL); |
| 579 | |
| 580 | int replaced = codegen->ReplaceCallSites(write_tuples_fn, write_complete_tuple_fn, |
| 581 | "WriteCompleteTuple"); |
| 582 | DCHECK_REPLACE_COUNT(replaced, 1); |
| 583 | |
| 584 | llvm::Function* copy_strings_fn; |
| 585 | RETURN_IF_ERROR(Tuple::CodegenCopyStrings( |
| 586 | codegen, *node->tuple_desc_, ©_strings_fn)); |
| 587 | replaced = codegen->ReplaceCallSites( |
| 588 | write_tuples_fn, copy_strings_fn, "CopyStrings"); |
| 589 | DCHECK_REPLACE_COUNT(replaced, 1); |
| 590 | |
| 591 | int tuple_byte_size = node->tuple_desc_->byte_size(); |
| 592 | replaced = codegen->ReplaceCallSitesWithValue(write_tuples_fn, |
| 593 | codegen->GetI32Constant(tuple_byte_size), "tuple_byte_size"); |
| 594 | DCHECK_REPLACE_COUNT(replaced, 1); |
| 595 | |
| 596 | *write_aligned_tuples_fn = codegen->FinalizeFunction(write_tuples_fn); |
| 597 | if (*write_aligned_tuples_fn == NULL) { |
| 598 | return Status("Failed to finalize write_aligned_tuples_fn."); |
| 599 | } |
| 600 | return Status::OK(); |
| 601 | } |
| 602 | |
| 603 | Status HdfsScanner::CodegenInitTuple( |
| 604 | const HdfsScanPlanNode* node, LlvmCodeGen* codegen, llvm::Function** init_tuple_fn) { |
nothing calls this directly
no test coverage detected