| 1612 | } |
| 1613 | |
| 1614 | pair<vector<llvm::Type*>, int> TupleDescriptor::GetLlvmTypesAndOffset( |
| 1615 | LlvmCodeGen* codegen, int curr_struct_offset) const { |
| 1616 | // Get slots in the order they will appear in LLVM struct. |
| 1617 | vector<SlotDescriptor*> sorted_slots = SlotsOrderedByIdx(); |
| 1618 | |
| 1619 | // Add the slot types to the struct description. |
| 1620 | vector<llvm::Type*> struct_fields; |
| 1621 | for (SlotDescriptor* slot: sorted_slots) { |
| 1622 | DCHECK_EQ(curr_struct_offset, slot->tuple_offset()); |
| 1623 | if (slot->type().IsStructType()) { |
| 1624 | const int slot_offset = slot->tuple_offset(); |
| 1625 | const TupleDescriptor* children_tuple = slot->children_tuple_descriptor(); |
| 1626 | DCHECK(children_tuple != nullptr); |
| 1627 | vector<llvm::Type*> child_field_types = children_tuple->GetLlvmTypesAndOffset( |
| 1628 | codegen, curr_struct_offset).first; |
| 1629 | llvm::StructType* struct_type = children_tuple->CreateLlvmStructTypeFromFieldTypes( |
| 1630 | codegen, child_field_types, slot_offset); |
| 1631 | struct_fields.push_back(struct_type); |
| 1632 | } else { |
| 1633 | struct_fields.push_back(codegen->GetSlotType(slot->type())); |
| 1634 | } |
| 1635 | curr_struct_offset = slot->tuple_offset() + slot->slot_size(); |
| 1636 | } |
| 1637 | return make_pair(struct_fields, curr_struct_offset); |
| 1638 | } |
| 1639 | |
| 1640 | llvm::StructType* TupleDescriptor::CreateLlvmStructTypeFromFieldTypes( |
| 1641 | LlvmCodeGen* codegen, const vector<llvm::Type*>& field_types, |
nothing calls this directly
no test coverage detected