Define the FieldRecord LLVM type

An individual field record for a nominal type consists of:

- 32-bit general purpose flags,
- 32-bit relative offset to the encoded type reference string, or
  32-bit relative offset to the mangled name of the type defined
  in another image, and
- 32-bit relative offset to the field name string.
This commit is contained in:
David Farler
2016-01-20 13:38:19 -08:00
parent 8afab353ff
commit 0b8a74800f
4 changed files with 93 additions and 0 deletions

View File

@@ -286,6 +286,13 @@ IRGenModule::IRGenModule(IRGenModuleDispatcher &dispatcher, SourceFile *SF,
TypeMetadataRecordPtrTy
= TypeMetadataRecordTy->getPointerTo(DefaultAS);
FieldRecordTy = createStructType(*this, "swift.field_record", {
Int32Ty, // Flags
RelativeAddressTy, // Offset to metadata or mangled name for external type
RelativeAddressTy, // Offset to field name
});
FieldRecordPtrTy = FieldRecordTy->getPointerTo(DefaultAS);
FixedBufferTy = nullptr;
for (unsigned i = 0; i != MaxNumValueWitnesses; ++i)
ValueWitnessTys[i] = nullptr;