llvm.org GIT mirror llvm / efd08d4
Remove the dependent libraries feature. The dependent libraries feature was never used and has bit-rotted. Remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168694 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 6 years ago
20 changed file(s) with 1 addition(s) and 158 deletion(s). Raw diff Collapse all Expand all
5353 MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N]
5454 MODULE_CODE_ASM = 4, // ASM: [strchr x N]
5555 MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N]
56 MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
5756
5857 // GLOBALVAR: [pointer type, isconst, initid,
5958 // linkage, alignment, section, visibility, threadlocal]
2020 #include "llvm/Metadata.h"
2121 #include "llvm/ADT/OwningPtr.h"
2222 #include "llvm/Support/DataTypes.h"
23 #include
2423
2524 namespace llvm {
2625
121120 /// The type for the list of named metadata.
122121 typedef ilist NamedMDListType;
123122
124 /// The type for the list of dependent libraries.
125 typedef std::vector LibraryListType;
126
127123 /// The Global Variable iterator.
128124 typedef GlobalListType::iterator global_iterator;
129125 /// The Global Variable constant iterator.
143139 typedef NamedMDListType::iterator named_metadata_iterator;
144140 /// The named metadata constant interators.
145141 typedef NamedMDListType::const_iterator const_named_metadata_iterator;
146 /// The Library list iterator.
147 typedef LibraryListType::const_iterator lib_iterator;
148142
149143 /// An enumeration for describing the endianess of the target machine.
150144 enum Endianness { AnyEndianness, LittleEndian, BigEndian };
194188 GlobalListType GlobalList; ///< The Global Variables in the module
195189 FunctionListType FunctionList; ///< The Functions in the module
196190 AliasListType AliasList; ///< The Aliases in the module
197 LibraryListType LibraryList; ///< The Libraries needed by the module
198191 NamedMDListType NamedMDList; ///< The named metadata in the module
199192 std::string GlobalScopeAsm; ///< Inline Asm at global scope.
200193 ValueSymbolTable *ValSymTab; ///< Symbol table for values
526519 bool empty() const { return FunctionList.empty(); }
527520
528521 /// @}
529 /// @name Dependent Library Iteration
530 /// @{
531
532 /// @brief Get a constant iterator to beginning of dependent library list.
533 inline lib_iterator lib_begin() const { return LibraryList.begin(); }
534 /// @brief Get a constant iterator to end of dependent library list.
535 inline lib_iterator lib_end() const { return LibraryList.end(); }
536 /// @brief Returns the number of items in the list of libraries.
537 inline size_t lib_size() const { return LibraryList.size(); }
538 /// @brief Add a library to the list of dependent libraries
539 void addLibrary(StringRef Lib);
540 /// @brief Remove a library from the list of dependent libraries
541 void removeLibrary(StringRef Lib);
542 /// @brief Get all the libraries
543 inline const LibraryListType& getLibraries() const { return LibraryList; }
544
545 /// @}
546522 /// @name Alias Iteration
547523 /// @{
548524
485485 KEYWORD(target);
486486 KEYWORD(triple);
487487 KEYWORD(unwind);
488 KEYWORD(deplibs);
489488 KEYWORD(datalayout);
490489 KEYWORD(volatile);
491490 KEYWORD(atomic);
167167 case lltok::kw_define: if (ParseDefine()) return true; break;
168168 case lltok::kw_module: if (ParseModuleAsm()) return true; break;
169169 case lltok::kw_target: if (ParseTargetDefinition()) return true; break;
170 case lltok::kw_deplibs: if (ParseDepLibs()) return true; break;
171170 case lltok::LocalVarID: if (ParseUnnamedType()) return true; break;
172171 case lltok::LocalVar: if (ParseNamedType()) return true; break;
173172 case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
261260 M->setDataLayout(Str);
262261 return false;
263262 }
264 }
265
266 /// toplevelentity
267 /// ::= 'deplibs' '=' '[' ']'
268 /// ::= 'deplibs' '=' '[' STRINGCONSTANT (',' STRINGCONSTANT)* ']'
269 bool LLParser::ParseDepLibs() {
270 assert(Lex.getKind() == lltok::kw_deplibs);
271 Lex.Lex();
272 if (ParseToken(lltok::equal, "expected '=' after deplibs") ||
273 ParseToken(lltok::lsquare, "expected '=' after deplibs"))
274 return true;
275
276 if (EatIfPresent(lltok::rsquare))
277 return false;
278
279 std::string Str;
280 if (ParseStringConstant(Str)) return true;
281 M->addLibrary(Str);
282
283 while (EatIfPresent(lltok::comma)) {
284 if (ParseStringConstant(Str)) return true;
285 M->addLibrary(Str);
286 }
287
288 return ParseToken(lltok::rsquare, "expected ']' at end of list");
289263 }
290264
291265 /// ParseUnnamedType:
215215 bool ParseTopLevelEntities();
216216 bool ValidateEndOfModule();
217217 bool ParseTargetDefinition();
218 bool ParseDepLibs();
219218 bool ParseModuleAsm();
220219 bool ParseUnnamedType();
221220 bool ParseNamedType();
5353 kw_target,
5454 kw_triple,
5555 kw_unwind,
56 kw_deplibs,
5756 kw_datalayout,
5857 kw_volatile,
5958 kw_atomic,
15631563 TheModule->setModuleInlineAsm(S);
15641564 break;
15651565 }
1566 case bitc::MODULE_CODE_DEPLIB: { // DEPLIB: [strchr x N]
1567 std::string S;
1568 if (ConvertToString(Record, 0, S))
1569 return Error("Invalid MODULE_CODE_DEPLIB record");
1570 TheModule->addLibrary(S);
1571 break;
1572 }
15731566 case bitc::MODULE_CODE_SECTIONNAME: { // SECTIONNAME: [strchr x N]
15741567 std::string S;
15751568 if (ConvertToString(Record, 0, S))
391391 // descriptors for global variables, and function prototype info.
392392 static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
393393 BitstreamWriter &Stream) {
394 // Emit the list of dependent libraries for the Module.
395 for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
396 WriteStringRecord(bitc::MODULE_CODE_DEPLIB, *I, 0/*TODO*/, Stream);
397
398394 // Emit various pieces of data attached to a module.
399395 if (!M->getTargetTriple().empty())
400396 WriteStringRecord(bitc::MODULE_CODE_TRIPLE, M->getTargetTriple(),
5050 }
5151 }
5252
53 // At this point we have processed all the link items provided to us. Since
54 // we have an aggregated module at this point, the dependent libraries in
55 // that module should also be aggregated with duplicates eliminated. This is
56 // now the time to process the dependent libraries to resolve any remaining
57 // symbols.
58 bool is_native;
59 for (Module::lib_iterator I = Composite->lib_begin(),
60 E = Composite->lib_end(); I != E; ++I) {
61 if(LinkInLibrary(*I, is_native))
62 return true;
63 if (is_native)
64 NativeItems.push_back(std::make_pair(*I, true));
65 }
66
6753 return false;
6854 }
6955
125111 bool is_native = false;
126112 for (unsigned i = 0; i < Libraries.size(); ++i)
127113 if (LinkInLibrary(Libraries[i], is_native))
128 return true;
129
130 // At this point we have processed all the libraries provided to us. Since
131 // we have an aggregated module at this point, the dependent libraries in
132 // that module should also be aggregated with duplicates eliminated. This is
133 // now the time to process the dependent libraries to resolve any remaining
134 // symbols.
135 const Module::LibraryListType& DepLibs = Composite->getLibraries();
136 for (Module::LibraryListType::const_iterator I = DepLibs.begin(),
137 E = DepLibs.end(); I != E; ++I)
138 if (LinkInLibrary(*I, is_native))
139114 return true;
140115
141116 return false;
11861186 SrcM->getModuleInlineAsm());
11871187 }
11881188
1189 // Update the destination module's dependent libraries list with the libraries
1190 // from the source module. There's no opportunity for duplicates here as the
1191 // Module ensures that duplicate insertions are discarded.
1192 for (Module::lib_iterator SI = SrcM->lib_begin(), SE = SrcM->lib_end();
1193 SI != SE; ++SI)
1194 DstM->addLibrary(*SI);
1195
1196 // If the source library's module id is in the dependent library list of the
1197 // destination library, remove it since that module is now linked in.
1198 StringRef ModuleId = SrcM->getModuleIdentifier();
1199 if (!ModuleId.empty())
1200 DstM->removeLibrary(sys::path::stem(ModuleId));
1201
12021189 // Loop over all of the linked values to compute type mappings.
12031190 computeTypeMapping();
12041191
19401940 }
19411941 nl(Out);
19421942
1943 // Loop over the dependent libraries and emit them.
1944 Module::lib_iterator LI = TheModule->lib_begin();
1945 Module::lib_iterator LE = TheModule->lib_end();
1946 while (LI != LE) {
1947 Out << "mod->addLibrary(\"" << *LI << "\");";
1948 nl(Out);
1949 ++LI;
1950 }
19511943 printModuleBody();
19521944 nl(Out) << "return mod;";
19531945 nl(Out,-1) << "}";
3737 New->setTargetTriple(M->getTargetTriple());
3838 New->setModuleInlineAsm(M->getModuleInlineAsm());
3939
40 // Copy all of the dependent libraries over.
41 for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
42 New->addLibrary(*I);
43
4440 // Loop over all of the global variables, making corresponding globals in the
4541 // new module. Here we add them to the VMap and to the new Module. We
4642 // don't worry about attributes or initializers, they will come later.
13021302 }
13031303 }
13041304
1305 // Loop over the dependent libraries and emit them.
1306 Module::lib_iterator LI = M->lib_begin();
1307 Module::lib_iterator LE = M->lib_end();
1308 if (LI != LE) {
1309 Out << '\n';
1310 Out << "deplibs = [ ";
1311 while (LI != LE) {
1312 Out << '"' << *LI << '"';
1313 ++LI;
1314 if (LI != LE)
1315 Out << ", ";
1316 }
1317 Out << " ]";
1318 }
1319
13201305 printTypeIdentities();
13211306
13221307 // Output all globals.
5454 GlobalList.clear();
5555 FunctionList.clear();
5656 AliasList.clear();
57 LibraryList.clear();
5857 NamedMDList.clear();
5958 delete ValSymTab;
6059 delete static_cast *>(NamedMDSymTab);
449448 for(Module::alias_iterator I = alias_begin(), E = alias_end(); I != E; ++I)
450449 I->dropAllReferences();
451450 }
452
453 void Module::addLibrary(StringRef Lib) {
454 for (Module::lib_iterator I = lib_begin(), E = lib_end(); I != E; ++I)
455 if (*I == Lib)
456 return;
457 LibraryList.push_back(Lib);
458 }
459
460 void Module::removeLibrary(StringRef Lib) {
461 LibraryListType::iterator I = LibraryList.begin();
462 LibraryListType::iterator E = LibraryList.end();
463 for (;I != E; ++I)
464 if (*I == Lib) {
465 LibraryList.erase(I);
466 return;
467 }
468 }
33
44 target datalayout = "e-p:32:32"
55 target triple = "proc-vend-sys"
6 deplibs = [ "m", "c" ]
44
55 target datalayout = "e-p:32:32"
66 target triple = "proc-vend-sys"
7 deplibs = [ "m", "c" ]
8
22
33 target datalayout = "E-p:32:32"
44 target triple = "powerpc-apple-darwin7.7.0"
5 deplibs = [ "c", "crtend" ]
65 @source = global <4 x i32> < i32 0, i32 1, i32 2, i32 3 > ; <<4 x i32>*> [#uses=0]
76
87 define i32 @main() {
9 entry:
10 ret i32 0
8 ret i32 0
119 }
12
11 ; PR993
22 target datalayout = "e-p:32:32"
33 target triple = "i386-unknown-openbsd3.9"
4 deplibs = [ "stdc++", "c", "crtend" ]
54 %"struct.__gnu_cxx::__normal_iterator, std::allocator > >" = type { i8* }
65 %"struct.__gnu_cxx::char_producer" = type { i32 (...)** }
76 %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
11 ; PR992
22 target datalayout = "e-p:32:32"
33 target triple = "i686-pc-linux-gnu"
4 deplibs = [ "stdc++", "c", "crtend" ]
54 %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
65 %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
76 %"struct.__cxxabiv1::__array_type_info" = type { %"struct.std::type_info" }
149149 case bitc::MODULE_CODE_DATALAYOUT: return "DATALAYOUT";
150150 case bitc::MODULE_CODE_ASM: return "ASM";
151151 case bitc::MODULE_CODE_SECTIONNAME: return "SECTIONNAME";
152 case bitc::MODULE_CODE_DEPLIB: return "DEPLIB";
153152 case bitc::MODULE_CODE_GLOBALVAR: return "GLOBALVAR";
154153 case bitc::MODULE_CODE_FUNCTION: return "FUNCTION";
155154 case bitc::MODULE_CODE_ALIAS: return "ALIAS";