diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-09-13 23:44:23 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-09-13 23:44:23 +0000 |
commit | b9e0877223bd643856febff60f2a4453c7d12581 (patch) | |
tree | 99a5b0da70e67609c9dabcd18d904328420a07a9 /llvm/lib | |
parent | 77aedd18c7c0fa70769f5aabe03a62e35367b736 (diff) | |
download | bcm5719-llvm-b9e0877223bd643856febff60f2a4453c7d12581.tar.gz bcm5719-llvm-b9e0877223bd643856febff60f2a4453c7d12581.zip |
Add support for the link-time pass list to Modules.
llvm-svn: 16321
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/AsmParser/Lexer.l | 1 | ||||
-rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 17 | ||||
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/VMCore/Module.cpp | 6 |
4 files changed, 37 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l index 45361bd77b8..9290cf1ae07 100644 --- a/llvm/lib/AsmParser/Lexer.l +++ b/llvm/lib/AsmParser/Lexer.l @@ -195,6 +195,7 @@ not { return NOT; } /* Deprecated, turned into XOR */ target { return TARGET; } triple { return TRIPLE; } deplibs { return DEPLIBS; } +passes { return PASSES; } endian { return ENDIAN; } pointersize { return POINTERSIZE; } little { return LITTLE; } diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 1fd8782daea..aec7b38dbdc 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -910,7 +910,7 @@ Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { %token DECLARE GLOBAL CONSTANT VOLATILE %token TO DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE WEAK APPENDING %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG -%token DEPLIBS +%token DEPLIBS PASSES // Basic Block Terminating Operators %token <TermOpVal> RET BR SWITCH INVOKE UNWIND @@ -1484,6 +1484,8 @@ ConstPool : ConstPool OptAssign TYPE TypesV { // Types can be defined in the co } | ConstPool DEPLIBS '=' LibrariesDefinition { } + | ConstPool PASSES '=' PassesDefinition { + } | /* empty: end of list */ { }; @@ -1522,6 +1524,19 @@ LibList : LibList ',' STRINGCONSTANT { } ; +PassesDefinition : '[' PassList ']'; +PassList : PassList ',' STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($3); + free($3); + } + | STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($1); + free($1); + } + | /* empty: end of list */ { + } + ; + //===----------------------------------------------------------------------===// // Rules to match Function Headers //===----------------------------------------------------------------------===// diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 0c4a1f78267..7f862dfbc59 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -777,6 +777,20 @@ void AssemblyWriter::printModule(const Module *M) { } Out << " ]\n"; } + + // Loop over the link time pass list and emit them + Module::pass_iterator PI = M->pass_begin(); + Module::pass_iterator PE = M->pass_end(); + if (LI != LE) { + Out << "passes = [\n"; + while (LI != LE) { + Out << "\"" << *LI << "\""; + ++LI; + if (LI != LE) + Out << ",\n"; + } + Out << " ]\n"; + } // Loop over the symbol table, emitting all named constants... printSymbolTable(M->getSymbolTable()); diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index d8caf7f1175..1dae14ec53f 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -270,6 +270,12 @@ std::string Module::getTypeName(const Type *Ty) const { return ""; // Must not have found anything... } +void Module::removePass(const std::string& Lib) { + PassListType::iterator I = find(PassList.begin(),PassList.end(),Lib); + if (I != PassList.end()) + PassList.erase(I); +} + //===----------------------------------------------------------------------===// // Other module related stuff. |