Lines Matching refs:lld

54 using namespace lld;
75 RefNameBuilder(const lld::File &file) in RefNameBuilder()
78 for (const lld::DefinedAtom *atom : file.defined()) { in RefNameBuilder()
84 for (const lld::Reference *ref : *atom) { in RefNameBuilder()
86 const lld::Atom *target = ref->target(); in RefNameBuilder()
101 for (const lld::UndefinedAtom *undefAtom : file.undefined()) { in RefNameBuilder()
104 for (const lld::SharedLibraryAtom *shlibAtom : file.sharedLibrary()) { in RefNameBuilder()
107 for (const lld::AbsoluteAtom *absAtom : file.absolute()) { in RefNameBuilder()
113 void buildDuplicateNameMap(const lld::Atom &atom) { in buildDuplicateNameMap()
128 const lld::Atom *prevAtom = pos->second; in buildDuplicateNameMap()
154 bool hasRefName(const lld::Atom *atom) { return _refNames.count(atom); } in hasRefName()
156 StringRef refName(const lld::Atom *atom) { in refName()
161 typedef llvm::StringMap<const lld::Atom *> NameToAtom;
162 typedef llvm::DenseMap<const lld::Atom *, std::string> AtomToRefName;
183 RefNameResolver(const lld::File *file, IO &io);
185 const lld::Atom *lookup(StringRef name) const { in lookup()
194 typedef llvm::StringMap<const lld::Atom *> NameToAtom;
196 void add(StringRef name, const lld::Atom *atom) { in add()
228 const lld::File *_content;
250 LLVM_YAML_IS_SEQUENCE_VECTOR(const lld::Reference *)
285 template <> struct ScalarEnumerationTraits<lld::File::Kind> {
286 static void enumeration(IO &io, lld::File::Kind &value) { in enumeration()
287 io.enumCase(value, "error-object", lld::File::kindErrorObject); in enumeration()
288 io.enumCase(value, "object", lld::File::kindMachObject); in enumeration()
289 io.enumCase(value, "shared-library", lld::File::kindSharedLibrary); in enumeration()
290 io.enumCase(value, "static-library", lld::File::kindArchiveLibrary); in enumeration()
294 template <> struct ScalarEnumerationTraits<lld::Atom::Scope> {
295 static void enumeration(IO &io, lld::Atom::Scope &value) { in enumeration()
296 io.enumCase(value, "global", lld::Atom::scopeGlobal); in enumeration()
297 io.enumCase(value, "hidden", lld::Atom::scopeLinkageUnit); in enumeration()
298 io.enumCase(value, "static", lld::Atom::scopeTranslationUnit); in enumeration()
302 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::SectionChoice> {
303 static void enumeration(IO &io, lld::DefinedAtom::SectionChoice &value) { in enumeration()
304 io.enumCase(value, "content", lld::DefinedAtom::sectionBasedOnContent); in enumeration()
305 io.enumCase(value, "custom", lld::DefinedAtom::sectionCustomPreferred); in enumeration()
307 lld::DefinedAtom::sectionCustomRequired); in enumeration()
311 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::Interposable> {
312 static void enumeration(IO &io, lld::DefinedAtom::Interposable &value) { in enumeration()
319 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::Merge> {
320 static void enumeration(IO &io, lld::DefinedAtom::Merge &value) { in enumeration()
321 io.enumCase(value, "no", lld::DefinedAtom::mergeNo); in enumeration()
322 io.enumCase(value, "as-tentative", lld::DefinedAtom::mergeAsTentative); in enumeration()
323 io.enumCase(value, "as-weak", lld::DefinedAtom::mergeAsWeak); in enumeration()
325 lld::DefinedAtom::mergeAsWeakAndAddressUsed); in enumeration()
326 io.enumCase(value, "by-content", lld::DefinedAtom::mergeByContent); in enumeration()
328 lld::DefinedAtom::mergeSameNameAndSize); in enumeration()
329 io.enumCase(value, "largest", lld::DefinedAtom::mergeByLargestSection); in enumeration()
333 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::DeadStripKind> {
334 static void enumeration(IO &io, lld::DefinedAtom::DeadStripKind &value) { in enumeration()
335 io.enumCase(value, "normal", lld::DefinedAtom::deadStripNormal); in enumeration()
336 io.enumCase(value, "never", lld::DefinedAtom::deadStripNever); in enumeration()
337 io.enumCase(value, "always", lld::DefinedAtom::deadStripAlways); in enumeration()
341 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::DynamicExport> {
342 static void enumeration(IO &io, lld::DefinedAtom::DynamicExport &value) { in enumeration()
343 io.enumCase(value, "normal", lld::DefinedAtom::dynamicExportNormal); in enumeration()
344 io.enumCase(value, "always", lld::DefinedAtom::dynamicExportAlways); in enumeration()
348 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::CodeModel> {
349 static void enumeration(IO &io, lld::DefinedAtom::CodeModel &value) { in enumeration()
350 io.enumCase(value, "none", lld::DefinedAtom::codeNA); in enumeration()
351 io.enumCase(value, "mips-pic", lld::DefinedAtom::codeMipsPIC); in enumeration()
352 io.enumCase(value, "mips-micro", lld::DefinedAtom::codeMipsMicro); in enumeration()
353 io.enumCase(value, "mips-micro-pic", lld::DefinedAtom::codeMipsMicroPIC); in enumeration()
354 io.enumCase(value, "mips-16", lld::DefinedAtom::codeMips16); in enumeration()
355 io.enumCase(value, "arm-thumb", lld::DefinedAtom::codeARMThumb); in enumeration()
356 io.enumCase(value, "arm-a", lld::DefinedAtom::codeARM_a); in enumeration()
357 io.enumCase(value, "arm-d", lld::DefinedAtom::codeARM_d); in enumeration()
358 io.enumCase(value, "arm-t", lld::DefinedAtom::codeARM_t); in enumeration()
363 struct ScalarEnumerationTraits<lld::DefinedAtom::ContentPermissions> {
364 static void enumeration(IO &io, lld::DefinedAtom::ContentPermissions &value) { in enumeration()
365 io.enumCase(value, "---", lld::DefinedAtom::perm___); in enumeration()
366 io.enumCase(value, "r--", lld::DefinedAtom::permR__); in enumeration()
367 io.enumCase(value, "r-x", lld::DefinedAtom::permR_X); in enumeration()
368 io.enumCase(value, "rw-", lld::DefinedAtom::permRW_); in enumeration()
369 io.enumCase(value, "rwx", lld::DefinedAtom::permRWX); in enumeration()
370 io.enumCase(value, "rw-l", lld::DefinedAtom::permRW_L); in enumeration()
371 io.enumCase(value, "unknown", lld::DefinedAtom::permUnknown); in enumeration()
375 template <> struct ScalarEnumerationTraits<lld::DefinedAtom::ContentType> {
376 static void enumeration(IO &io, lld::DefinedAtom::ContentType &value) { in enumeration()
433 template <> struct ScalarEnumerationTraits<lld::UndefinedAtom::CanBeNull> {
434 static void enumeration(IO &io, lld::UndefinedAtom::CanBeNull &value) { in enumeration()
435 io.enumCase(value, "never", lld::UndefinedAtom::canBeNullNever); in enumeration()
436 io.enumCase(value, "at-runtime", lld::UndefinedAtom::canBeNullAtRuntime); in enumeration()
437 io.enumCase(value, "at-buildtime",lld::UndefinedAtom::canBeNullAtBuildtime); in enumeration()
449 struct ScalarEnumerationTraits<lld::SharedLibraryAtom::Type> {
450 static void enumeration(IO &io, lld::SharedLibraryAtom::Type &value) { in enumeration()
451 io.enumCase(value, "code", lld::SharedLibraryAtom::Type::Code); in enumeration()
452 io.enumCase(value, "data", lld::SharedLibraryAtom::Type::Data); in enumeration()
453 io.enumCase(value, "unknown", lld::SharedLibraryAtom::Type::Unknown); in enumeration()
461 template <> struct ScalarTraits<lld::DefinedAtom::Alignment> {
462 static void output(const lld::DefinedAtom::Alignment &value, void *ctxt, in output()
472 lld::DefinedAtom::Alignment &value) { in input()
558 template <> struct DocumentListTraits<std::vector<const lld::File *> > {
559 static size_t size(IO &io, std::vector<const lld::File *> &seq) { in size()
562 static const lld::File *&element(IO &io, std::vector<const lld::File *> &seq, in element()
571 template <> struct MappingTraits<const lld::File *> {
572 class NormArchiveFile : public lld::ArchiveLibraryFile {
576 NormArchiveFile(IO &io, const lld::File *file) in NormArchiveFile()
582 const lld::File *denormalize(IO &io) { return this; } in denormalize()
584 const AtomRange<lld::DefinedAtom> defined() const override { in defined()
588 const AtomRange<lld::UndefinedAtom> undefined() const override { in undefined()
592 const AtomRange<lld::SharedLibraryAtom> sharedLibrary() const override { in sharedLibrary()
596 const AtomRange<lld::AbsoluteAtom> absolute() const override { in absolute()
609 for (const lld::DefinedAtom *atom : member._content->defined()) in find()
624 class NormalizedFile : public lld::File {
633 NormalizedFile(IO &io, const lld::File *file) in NormalizedFile()
645 const lld::File *denormalize(IO &io);
647 const AtomRange<lld::DefinedAtom> defined() const override { in defined()
651 const AtomRange<lld::UndefinedAtom> undefined() const override { in undefined()
655 const AtomRange<lld::SharedLibraryAtom> sharedLibrary() const override { in sharedLibrary()
659 const AtomRange<lld::AbsoluteAtom> absolute() const override { in absolute()
681 AtomList<lld::DefinedAtom> _definedAtoms;
682 AtomList<lld::UndefinedAtom> _undefinedAtoms;
683 AtomList<lld::SharedLibraryAtom> _sharedLibraryAtoms;
684 AtomList<lld::AbsoluteAtom> _absoluteAtoms;
685 AtomRange<lld::DefinedAtom> _definedAtomsRef;
686 AtomRange<lld::UndefinedAtom> _undefinedAtomsRef;
687 AtomRange<lld::SharedLibraryAtom> _sharedLibraryAtomsRef;
688 AtomRange<lld::AbsoluteAtom> _absoluteAtomsRef;
692 static void mapping(IO &io, const lld::File *&file) { in mapping()
704 static void mappingAtoms(IO &io, const lld::File *&file) { in mappingAtoms()
706 MappingNormalizationHeap<NormalizedFile, const lld::File *> in mappingAtoms()
726 static void mappingArchive(IO &io, const lld::File *&file) { in mappingArchive()
728 MappingNormalizationHeap<NormArchiveFile, const lld::File *> in mappingArchive()
737 template <> struct MappingTraits<const lld::Reference *> {
738 class NormalizedReference : public lld::Reference {
741 : lld::Reference(lld::Reference::KindNamespace::all, in NormalizedReference()
742 lld::Reference::KindArch::all, 0), in NormalizedReference()
745 NormalizedReference(IO &io, const lld::Reference *ref) in NormalizedReference()
746 : lld::Reference(ref->kindNamespace(), ref->kindArch(), in NormalizedReference()
756 const lld::Reference *denormalize(IO &io) { in denormalize()
759 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
775 static StringRef targetName(IO &io, const lld::Reference *ref);
778 const lld::Atom *target() const override { return _target; } in target()
781 void setTarget(const lld::Atom *a) override { _target = a; } in setTarget()
783 const lld::Atom *_target;
791 static void mapping(IO &io, const lld::Reference *&ref) { in mapping()
793 MappingNormalizationHeap<NormalizedReference, const lld::Reference *> keys( in mapping()
799 io.mapOptional("addend", keys->_addend, (lld::Reference::Addend)0); in mapping()
805 template <> struct MappingTraits<const lld::DefinedAtom *> {
807 class NormalizedAtom : public lld::DefinedAtom {
815 NormalizedAtom(IO &io, const lld::DefinedAtom *atom) in NormalizedAtom()
825 for (const lld::Reference *r : *atom) in NormalizedAtom()
837 const lld::DefinedAtom *denormalize(IO &io) { in denormalize()
840 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
858 const lld::File &fileFromContext(IO &io) { in fileFromContext()
865 const lld::File &file() const override { return _file; } in file()
899 const lld::Reference *derefIterator(const void *it) const override { in derefIterator()
920 const lld::File &_file;
938 std::vector<const lld::Reference *> _references;
941 static void mapping(IO &io, const lld::DefinedAtom *&atom) { in mapping()
943 MappingNormalizationHeap<NormalizedAtom, const lld::DefinedAtom *> keys( in mapping()
947 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in mapping()
987 template <> struct MappingTraits<lld::DefinedAtom *> {
988 static void mapping(IO &io, lld::DefinedAtom *&atom) { in mapping()
989 const lld::DefinedAtom *atomPtr = atom; in mapping()
990 MappingTraits<const lld::DefinedAtom *>::mapping(io, atomPtr); in mapping()
991 atom = const_cast<lld::DefinedAtom *>(atomPtr); in mapping()
996 template <> struct MappingTraits<const lld::UndefinedAtom *> {
997 class NormalizedAtom : public lld::UndefinedAtom {
1002 NormalizedAtom(IO &io, const lld::UndefinedAtom *atom) in NormalizedAtom()
1008 const lld::UndefinedAtom *denormalize(IO &io) { in denormalize()
1011 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1024 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1031 const lld::File &file() const override { return _file; } in file()
1035 const lld::File &_file;
1040 static void mapping(IO &io, const lld::UndefinedAtom *&atom) { in mapping()
1042 MappingNormalizationHeap<NormalizedAtom, const lld::UndefinedAtom *> keys( in mapping()
1047 lld::UndefinedAtom::canBeNullNever); in mapping()
1051 template <> struct MappingTraits<lld::UndefinedAtom *> {
1052 static void mapping(IO &io, lld::UndefinedAtom *&atom) { in mapping()
1053 const lld::UndefinedAtom *atomPtr = atom; in mapping()
1054 MappingTraits<const lld::UndefinedAtom *>::mapping(io, atomPtr); in mapping()
1055 atom = const_cast<lld::UndefinedAtom *>(atomPtr); in mapping()
1060 template <> struct MappingTraits<const lld::SharedLibraryAtom *> {
1061 class NormalizedAtom : public lld::SharedLibraryAtom {
1067 NormalizedAtom(IO &io, const lld::SharedLibraryAtom *atom) in NormalizedAtom()
1074 const lld::SharedLibraryAtom *denormalize(IO &io) { in denormalize()
1077 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1093 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1100 const lld::File &file() const override { return _file; } in file()
1107 const lld::File &_file;
1115 static void mapping(IO &io, const lld::SharedLibraryAtom *&atom) { in mapping()
1118 MappingNormalizationHeap<NormalizedAtom, const lld::SharedLibraryAtom *> in mapping()
1129 template <> struct MappingTraits<lld::SharedLibraryAtom *> {
1130 static void mapping(IO &io, lld::SharedLibraryAtom *&atom) { in mapping()
1131 const lld::SharedLibraryAtom *atomPtr = atom; in mapping()
1132 MappingTraits<const lld::SharedLibraryAtom *>::mapping(io, atomPtr); in mapping()
1133 atom = const_cast<lld::SharedLibraryAtom *>(atomPtr); in mapping()
1138 template <> struct MappingTraits<const lld::AbsoluteAtom *> {
1139 class NormalizedAtom : public lld::AbsoluteAtom {
1144 NormalizedAtom(IO &io, const lld::AbsoluteAtom *atom) in NormalizedAtom()
1150 const lld::AbsoluteAtom *denormalize(IO &io) { in denormalize()
1153 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in denormalize()
1166 const lld::File &fileFromContext(IO &io) { in fileFromContext()
1173 const lld::File &file() const override { return _file; } in file()
1178 const lld::File &_file;
1185 static void mapping(IO &io, const lld::AbsoluteAtom *&atom) { in mapping()
1187 MappingNormalizationHeap<NormalizedAtom, const lld::AbsoluteAtom *> keys( in mapping()
1191 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in mapping()
1209 template <> struct MappingTraits<lld::AbsoluteAtom *> {
1210 static void mapping(IO &io, lld::AbsoluteAtom *&atom) { in mapping()
1211 const lld::AbsoluteAtom *atomPtr = atom; in mapping()
1212 MappingTraits<const lld::AbsoluteAtom *>::mapping(io, atomPtr); in mapping()
1213 atom = const_cast<lld::AbsoluteAtom *>(atomPtr); in mapping()
1220 RefNameResolver::RefNameResolver(const lld::File *file, IO &io) : _io(io) { in RefNameResolver()
1221 typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom in RefNameResolver()
1223 for (const lld::DefinedAtom *a : file->defined()) { in RefNameResolver()
1231 for (const lld::UndefinedAtom *a : file->undefined()) in RefNameResolver()
1234 for (const lld::SharedLibraryAtom *a : file->sharedLibrary()) in RefNameResolver()
1237 typedef MappingTraits<const lld::AbsoluteAtom *>::NormalizedAtom NormAbsAtom; in RefNameResolver()
1238 for (const lld::AbsoluteAtom *a : file->absolute()) { in RefNameResolver()
1247 inline const lld::File *
1248 MappingTraits<const lld::File *>::NormalizedFile::denormalize(IO &io) { in denormalize()
1249 typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom in denormalize()
1254 for (const lld::DefinedAtom *a : this->defined()) { in denormalize()
1262 inline void MappingTraits<const lld::DefinedAtom *>::NormalizedAtom::bind( in bind()
1264 typedef MappingTraits<const lld::Reference *>::NormalizedReference in bind()
1266 for (const lld::Reference *ref : _references) { in bind()
1272 inline void MappingTraits<const lld::Reference *>::NormalizedReference::bind( in bind()
1278 MappingTraits<const lld::Reference *>::NormalizedReference::targetName( in targetName()
1279 IO &io, const lld::Reference *ref) { in targetName()
1284 typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; in targetName()
1292 namespace lld { namespace
1295 class Writer : public lld::Writer {
1299 llvm::Error writeFile(const lld::File &file, StringRef outPath) override { in writeFile()
1313 const lld::File *fileRef = &file; in writeFile()
1329 bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override { in handledDocTag()
1331 MappingTraits<const lld::File *>::mappingAtoms(io, file); in handledDocTag()
1340 bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override { in handledDocTag()
1342 MappingTraits<const lld::File *>::mappingArchive(io, file); in handledDocTag()
1368 std::vector<const lld::File *> createdFiles; in loadFile()
1374 return make_error_code(lld::YamlReaderError::illegal_value); in loadFile()
1400 return std::unique_ptr<Writer>(new lld::yaml::Writer(context)); in createWriterYAML()