| 992 | } |
| 993 | |
| 994 | void SlotDescriptor::CodegenStoreStructToNativePtr( |
| 995 | const CodegenAnyValReadWriteInfo& read_write_info, llvm::Value* main_tuple_ptr, |
| 996 | llvm::Value* struct_slot_ptr, llvm::Value* pool_val, |
| 997 | const NonWritableBasicBlock& insert_before) const { |
| 998 | DCHECK(type_.IsStructType()); |
| 999 | DCHECK(children_tuple_descriptor_ != nullptr); |
| 1000 | DCHECK(read_write_info.type().IsStructType()); |
| 1001 | DCHECK(main_tuple_ptr->getType()->isPointerTy()); |
| 1002 | DCHECK(main_tuple_ptr->getType()->getPointerElementType()->isStructTy()); |
| 1003 | DCHECK(struct_slot_ptr->getType()->isPointerTy()); |
| 1004 | DCHECK(struct_slot_ptr->getType()->getPointerElementType()->isStructTy()); |
| 1005 | |
| 1006 | LlvmBuilder* builder = read_write_info.builder(); |
| 1007 | const std::vector<SlotDescriptor*>& slots = children_tuple_descriptor_->slots(); |
| 1008 | DCHECK_GE(slots.size(), 1); |
| 1009 | DCHECK_EQ(slots.size(), read_write_info.children().size()); |
| 1010 | |
| 1011 | read_write_info.children()[0].entry_block().BranchTo(builder); |
| 1012 | for (int i = 0; i < slots.size(); ++i) { |
| 1013 | const SlotDescriptor* const child_slot_desc = slots[i]; |
| 1014 | const CodegenAnyValReadWriteInfo& child_read_write_info = |
| 1015 | read_write_info.children()[i]; |
| 1016 | |
| 1017 | NonWritableBasicBlock next_block = i == slots.size() - 1 |
| 1018 | ? insert_before : read_write_info.children()[i+1].entry_block(); |
| 1019 | child_slot_desc->CodegenWriteToSlotHelper(child_read_write_info, main_tuple_ptr, |
| 1020 | struct_slot_ptr, pool_val, next_block); |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | // Create a 'CodegenAnyValReadWriteInfo' but without creating basic blocks for null |
| 1025 | // handling as this function should only be called if we assume that the value is not |
nothing calls this directly
no test coverage detected