Lines Matching refs:lld
55 using namespace lld;
76 RefNameBuilder(const lld::File &file) in RefNameBuilder()
79 for (const lld::DefinedAtom *atom : file.defined()) { in RefNameBuilder()
85 for (const lld::Reference *ref : *atom) { in RefNameBuilder()
87 const lld::Atom *target = ref->target(); in RefNameBuilder()
102 for (const lld::UndefinedAtom *undefAtom : file.undefined()) { in RefNameBuilder()
105 for (const lld::SharedLibraryAtom *shlibAtom : file.sharedLibrary()) { in RefNameBuilder()
108 for (const lld::AbsoluteAtom *absAtom : file.absolute()) { in RefNameBuilder()
114 void buildDuplicateNameMap(const lld::Atom &atom) { in buildDuplicateNameMap()
129 const lld::Atom *prevAtom = pos->second; in buildDuplicateNameMap()
155 bool hasRefName(const lld::Atom *atom) { return _refNames.count(atom); } in hasRefName()
157 StringRef refName(const lld::Atom *atom) { in refName()
162 typedef llvm::StringMap<const lld::Atom *> NameToAtom;
163 typedef llvm::DenseMap<const lld::Atom *, std::string> AtomToRefName;
184 RefNameResolver(const lld::File *file, IO &io);
186 const lld::Atom *lookup(StringRef name) const { in lookup()
195 typedef llvm::StringMap<const lld::Atom *> NameToAtom;
197 void add(StringRef name, const lld::Atom *atom) { in add()
229 const lld::File *_content;
251 LLVM_YAML_IS_SEQUENCE_VECTOR(const lld::Reference *)
286 template <> struct ScalarEnumerationTraits<lld::File::Kind> {
287 static void enumeration(IO &io, lld::File::Kind &value) { in enumeration()
288 io.enumCase(value, "error-object", lld::File::kindErrorObject); in enumeration()
289 io.enumCase(value, "object", lld::File::kindMachObject); in enumeration()
290 io.enumCase(value, "shared-library", lld::File::kindSharedLibrary); in enumeration()
291 io.enumCase(value, "static-library", lld::File::kindArchiveLibrary); in enumeration()
295 template <> struct ScalarEnumerationTraits<lld::Atom::Scope> {
296 static void enumeration(IO &io, lld::Atom::Scope &value) { in enumeration()
297 io.enumCase(value, "global", lld::Atom::scopeGlobal); in enumeration()
298 io.enumCase(value, "hidden", lld::Atom::scopeLinkageUnit); in enumeration()
299 io.enumCase(value, "static", lld::Atom::scopeTranslationUnit); in enumeration()
303 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::SectionChoice> {
304 static void enumeration(IO &io, lld::DefinedAtom::SectionChoice &value) { in enumeration()
305 io.enumCase(value, "content", lld::DefinedAtom::sectionBasedOnContent); in enumeration()
306 io.enumCase(value, "custom", lld::DefinedAtom::sectionCustomPreferred); in enumeration()
308 lld::DefinedAtom::sectionCustomRequired); in enumeration()
312 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::Interposable> {
313 static void enumeration(IO &io, lld::DefinedAtom::Interposable &value) { in enumeration()
320 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::Merge> {
321 static void enumeration(IO &io, lld::DefinedAtom::Merge &value) { in enumeration()
322 io.enumCase(value, "no", lld::DefinedAtom::mergeNo); in enumeration()
323 io.enumCase(value, "as-tentative", lld::DefinedAtom::mergeAsTentative); in enumeration()
324 io.enumCase(value, "as-weak", lld::DefinedAtom::mergeAsWeak); in enumeration()
326 lld::DefinedAtom::mergeAsWeakAndAddressUsed); in enumeration()
327 io.enumCase(value, "by-content", lld::DefinedAtom::mergeByContent); in enumeration()
329 lld::DefinedAtom::mergeSameNameAndSize); in enumeration()
330 io.enumCase(value, "largest", lld::DefinedAtom::mergeByLargestSection); in enumeration()
334 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::DeadStripKind> {
335 static void enumeration(IO &io, lld::DefinedAtom::DeadStripKind &value) { in enumeration()
336 io.enumCase(value, "normal", lld::DefinedAtom::deadStripNormal); in enumeration()
337 io.enumCase(value, "never", lld::DefinedAtom::deadStripNever); in enumeration()
338 io.enumCase(value, "always", lld::DefinedAtom::deadStripAlways); in enumeration()
342 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::DynamicExport> {
343 static void enumeration(IO &io, lld::DefinedAtom::DynamicExport &value) { in enumeration()
344 io.enumCase(value, "normal", lld::DefinedAtom::dynamicExportNormal); in enumeration()
345 io.enumCase(value, "always", lld::DefinedAtom::dynamicExportAlways); in enumeration()
349 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::CodeModel> {
350 static void enumeration(IO &io, lld::DefinedAtom::CodeModel &value) { in enumeration()
351 io.enumCase(value, "none", lld::DefinedAtom::codeNA); in enumeration()
352 io.enumCase(value, "mips-pic", lld::DefinedAtom::codeMipsPIC); in enumeration()
353 io.enumCase(value, "mips-micro", lld::DefinedAtom::codeMipsMicro); in enumeration()
354 io.enumCase(value, "mips-micro-pic", lld::DefinedAtom::codeMipsMicroPIC); in enumeration()
355 io.enumCase(value, "mips-16", lld::DefinedAtom::codeMips16); in enumeration()
356 io.enumCase(value, "arm-thumb", lld::DefinedAtom::codeARMThumb); in enumeration()
357 io.enumCase(value, "arm-a", lld::DefinedAtom::codeARM_a); in enumeration()
358 io.enumCase(value, "arm-d", lld::DefinedAtom::codeARM_d); in enumeration()
359 io.enumCase(value, "arm-t", lld::DefinedAtom::codeARM_t); in enumeration()
364 struct ScalarEnumerationTraits<lld::DefinedAtom::ContentPermissions> {
365 static void enumeration(IO &io, lld::DefinedAtom::ContentPermissions &value) { in enumeration()
366 io.enumCase(value, "---", lld::DefinedAtom::perm___); in enumeration()
367 io.enumCase(value, "r--", lld::DefinedAtom::permR__); in enumeration()
368 io.enumCase(value, "r-x", lld::DefinedAtom::permR_X); in enumeration()
369 io.enumCase(value, "rw-", lld::DefinedAtom::permRW_); in enumeration()
370 io.enumCase(value, "rwx", lld::DefinedAtom::permRWX); in enumeration()
371 io.enumCase(value, "rw-l", lld::DefinedAtom::permRW_L); in enumeration()
372 io.enumCase(value, "unknown", lld::DefinedAtom::permUnknown); in enumeration()
376 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::ContentType> {
377 static void enumeration(IO &io, lld::DefinedAtom::ContentType &value) { in enumeration()
434 template <> struct ScalarEnumerationTraits<lld::UndefinedAtom::CanBeNull> {
435 static void enumeration(IO &io, lld::UndefinedAtom::CanBeNull &value) { in enumeration()
436 io.enumCase(value, "never", lld::UndefinedAtom::canBeNullNever); in enumeration()
437 io.enumCase(value, "at-runtime", lld::UndefinedAtom::canBeNullAtRuntime); in enumeration()
438 io.enumCase(value, "at-buildtime",lld::UndefinedAtom::canBeNullAtBuildtime); in enumeration()
450 struct ScalarEnumerationTraits<lld::SharedLibraryAtom::Type> {
451 static void enumeration(IO &io, lld::SharedLibraryAtom::Type &value) { in enumeration()
452 io.enumCase(value, "code", lld::SharedLibraryAtom::Type::Code); in enumeration()
453 io.enumCase(value, "data", lld::SharedLibraryAtom::Type::Data); in enumeration()
454 io.enumCase(value, "unknown", lld::SharedLibraryAtom::Type::Unknown); in enumeration()
462 template <> struct ScalarTraits<lld::DefinedAtom::Alignment> {
463 static void output(const lld::DefinedAtom::Alignment &value, void *ctxt, in output()
473 lld::DefinedAtom::Alignment &value) { in input()
559 template <> struct DocumentListTraits<std::vector<const lld::File *> > {
560 static size_t size(IO &io, std::vector<const lld::File *> &seq) { in size()
563 static const lld::File *&element(IO &io, std::vector<const lld::File *> &seq, in element()
572 template <> struct MappingTraits<const lld::File *> {
573 class NormArchiveFile : public lld::ArchiveLibraryFile {
577 NormArchiveFile(IO &io, const lld::File *file) in NormArchiveFile()
583 const lld::File *denormalize(IO &io) { return this; } in denormalize()
585 const AtomRange<lld::DefinedAtom> defined() const override { in defined()
589 const AtomRange<lld::UndefinedAtom> undefined() const override { in undefined()
593 const AtomRange<lld::SharedLibraryAtom> sharedLibrary() const override { in sharedLibrary()
597 const AtomRange<lld::AbsoluteAtom> absolute() const override { in absolute()
610 for (const lld::DefinedAtom *atom : member._content->defined()) in find()
625 class NormalizedFile : public lld::File {
634 NormalizedFile(IO &io, const lld::File *file) in NormalizedFile()
646 const lld::File *denormalize(IO &io);
648 const AtomRange<lld::DefinedAtom> defined() const override { in defined()
652 const AtomRange<lld::UndefinedAtom> undefined() const override { in undefined()
656 const AtomRange<lld::SharedLibraryAtom> sharedLibrary() const override { in sharedLibrary()
660 const AtomRange<lld::AbsoluteAtom> absolute() const override { in absolute()
682 AtomList<lld::DefinedAtom> _definedAtoms;
683 AtomList<lld::UndefinedAtom> _undefinedAtoms;
684 AtomList<lld::SharedLibraryAtom> _sharedLibraryAtoms;
685 AtomList<lld::AbsoluteAtom> _absoluteAtoms;
686 AtomRange<lld::DefinedAtom> _definedAtomsRef;
687 AtomRange<lld::UndefinedAtom> _undefinedAtomsRef;
688 AtomRange<lld::SharedLibraryAtom> _sharedLibraryAtomsRef;
689 AtomRange<lld::AbsoluteAtom> _absoluteAtomsRef;
693 static void mapping(IO &io, const lld::File *&file) { in mapping()
705 static void mappingAtoms(IO &io, const lld::File *&file) { in mappingAtoms()
707 MappingNormalizationHeap<NormalizedFile, const lld::File *> in mappingAtoms()
727 static void mappingArchive(IO &io, const lld::File *&file) { in mappingArchive()
729 MappingNormalizationHeap<NormArchiveFile, const lld::File *> in mappingArchive()
738 template <> struct MappingTraits<const lld::Reference *> {
739 class NormalizedReference : public lld::Reference {
742 : lld::Reference(lld::Reference::KindNamespace::all, in NormalizedReference()
743 lld::Reference::KindArch::all, 0), in NormalizedReference()
746 NormalizedReference(IO &io, const lld::Reference *ref) in NormalizedReference()
747 : lld::Reference(ref->kindNamespace(), ref->kindArch(), in NormalizedReference()
757 const lld::Reference *denormalize(IO &io) { in denormalize()
760 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
776 static StringRef targetName(IO &io, const lld::Reference *ref);
779 const lld::Atom *target() const override { return _target; } in target()
782 void setTarget(const lld::Atom *a) override { _target = a; } in setTarget()
784 const lld::Atom *_target;
792 static void mapping(IO &io, const lld::Reference *&ref) { in mapping()
794 MappingNormalizationHeap<NormalizedReference, const lld::Reference *> keys( in mapping()
800 io.mapOptional("addend", keys->_addend, (lld::Reference::Addend)0); in mapping()
806 template <> struct MappingTraits<const lld::DefinedAtom *> {
808 class NormalizedAtom : public lld::DefinedAtom {
816 NormalizedAtom(IO &io, const lld::DefinedAtom *atom) in NormalizedAtom()
826 for (const lld::Reference *r : *atom) in NormalizedAtom()
838 const lld::DefinedAtom *denormalize(IO &io) { in denormalize()
841 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
859 const lld::File &fileFromContext(IO &io) { in fileFromContext()
866 const lld::File &file() const override { return _file; } in file()
900 const lld::Reference *derefIterator(const void *it) const override { in derefIterator()
921 const lld::File &_file;
939 std::vector<const lld::Reference *> _references;
942 static void mapping(IO &io, const lld::DefinedAtom *&atom) { in mapping()
944 MappingNormalizationHeap<NormalizedAtom, const lld::DefinedAtom *> keys( in mapping()
948 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in mapping()
988 template <> struct MappingTraits<lld::DefinedAtom *> {
989 static void mapping(IO &io, lld::DefinedAtom *&atom) { in mapping()
990 const lld::DefinedAtom *atomPtr = atom; in mapping()
991 MappingTraits<const lld::DefinedAtom *>::mapping(io, atomPtr); in mapping()
992 atom = const_cast<lld::DefinedAtom *>(atomPtr); in mapping()
997 template <> struct MappingTraits<const lld::UndefinedAtom *> {
998 class NormalizedAtom : public lld::UndefinedAtom {
1003 NormalizedAtom(IO &io, const lld::UndefinedAtom *atom) in NormalizedAtom()
1009 const lld::UndefinedAtom *denormalize(IO &io) { in denormalize()
1012 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1025 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1032 const lld::File &file() const override { return _file; } in file()
1036 const lld::File &_file;
1041 static void mapping(IO &io, const lld::UndefinedAtom *&atom) { in mapping()
1043 MappingNormalizationHeap<NormalizedAtom, const lld::UndefinedAtom *> keys( in mapping()
1048 lld::UndefinedAtom::canBeNullNever); in mapping()
1052 template <> struct MappingTraits<lld::UndefinedAtom *> {
1053 static void mapping(IO &io, lld::UndefinedAtom *&atom) { in mapping()
1054 const lld::UndefinedAtom *atomPtr = atom; in mapping()
1055 MappingTraits<const lld::UndefinedAtom *>::mapping(io, atomPtr); in mapping()
1056 atom = const_cast<lld::UndefinedAtom *>(atomPtr); in mapping()
1061 template <> struct MappingTraits<const lld::SharedLibraryAtom *> {
1062 class NormalizedAtom : public lld::SharedLibraryAtom {
1068 NormalizedAtom(IO &io, const lld::SharedLibraryAtom *atom) in NormalizedAtom()
1075 const lld::SharedLibraryAtom *denormalize(IO &io) { in denormalize()
1078 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1094 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1101 const lld::File &file() const override { return _file; } in file()
1108 const lld::File &_file;
1116 static void mapping(IO &io, const lld::SharedLibraryAtom *&atom) { in mapping()
1119 MappingNormalizationHeap<NormalizedAtom, const lld::SharedLibraryAtom *> in mapping()
1130 template <> struct MappingTraits<lld::SharedLibraryAtom *> {
1131 static void mapping(IO &io, lld::SharedLibraryAtom *&atom) { in mapping()
1132 const lld::SharedLibraryAtom *atomPtr = atom; in mapping()
1133 MappingTraits<const lld::SharedLibraryAtom *>::mapping(io, atomPtr); in mapping()
1134 atom = const_cast<lld::SharedLibraryAtom *>(atomPtr); in mapping()
1139 template <> struct MappingTraits<const lld::AbsoluteAtom *> {
1140 class NormalizedAtom : public lld::AbsoluteAtom {
1145 NormalizedAtom(IO &io, const lld::AbsoluteAtom *atom) in NormalizedAtom()
1151 const lld::AbsoluteAtom *denormalize(IO &io) { in denormalize()
1154 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1167 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1174 const lld::File &file() const override { return _file; } in file()
1179 const lld::File &_file;
1186 static void mapping(IO &io, const lld::AbsoluteAtom *&atom) { in mapping()
1188 MappingNormalizationHeap<NormalizedAtom, const lld::AbsoluteAtom *> keys( in mapping()
1192 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in mapping()
1210 template <> struct MappingTraits<lld::AbsoluteAtom *> {
1211 static void mapping(IO &io, lld::AbsoluteAtom *&atom) { in mapping()
1212 const lld::AbsoluteAtom *atomPtr = atom; in mapping()
1213 MappingTraits<const lld::AbsoluteAtom *>::mapping(io, atomPtr); in mapping()
1214 atom = const_cast<lld::AbsoluteAtom *>(atomPtr); in mapping()
1221 RefNameResolver::RefNameResolver(const lld::File *file, IO &io) : _io(io) { in RefNameResolver()
1222 typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom in RefNameResolver()
1224 for (const lld::DefinedAtom *a : file->defined()) { in RefNameResolver()
1232 for (const lld::UndefinedAtom *a : file->undefined()) in RefNameResolver()
1235 for (const lld::SharedLibraryAtom *a : file->sharedLibrary()) in RefNameResolver()
1238 typedef MappingTraits<const lld::AbsoluteAtom *>::NormalizedAtom NormAbsAtom; in RefNameResolver()
1239 for (const lld::AbsoluteAtom *a : file->absolute()) { in RefNameResolver()
1248 inline const lld::File *
1249 MappingTraits<const lld::File *>::NormalizedFile::denormalize(IO &io) { in denormalize()
1250 typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom in denormalize()
1255 for (const lld::DefinedAtom *a : this->defined()) { in denormalize()
1263 inline void MappingTraits<const lld::DefinedAtom *>::NormalizedAtom::bind( in bind()
1265 typedef MappingTraits<const lld::Reference *>::NormalizedReference in bind()
1267 for (const lld::Reference *ref : _references) { in bind()
1273 inline void MappingTraits<const lld::Reference *>::NormalizedReference::bind( in bind()
1279 MappingTraits<const lld::Reference *>::NormalizedReference::targetName( in targetName()
1280 IO &io, const lld::Reference *ref) { in targetName()
1285 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in targetName()
1293 namespace lld { namespace
1296 class Writer : public lld::Writer {
1300 llvm::Error writeFile(const lld::File &file, StringRef outPath) override { in writeFile()
1314 const lld::File *fileRef = &file; in writeFile()
1330 bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override { in handledDocTag()
1332 MappingTraits<const lld::File *>::mappingAtoms(io, file); in handledDocTag()
1341 bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override { in handledDocTag()
1343 MappingTraits<const lld::File *>::mappingArchive(io, file); in handledDocTag()
1369 std::vector<const lld::File *> createdFiles; in loadFile()
1375 return make_error_code(lld::YamlReaderError::illegal_value); in loadFile()
1401 return std::unique_ptr<Writer>(new lld::yaml::Writer(context)); in createWriterYAML()