[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

Reid Spencer reid at x10sys.com
Fri Dec 29 12:30:07 PST 2006



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.230 -> 1.231
---
Log message:

For PR950: http://llvm.org/PR950 :
Remove all grammar conflicts from assembly parsing.  This change involves:
1. Making the "type" keyword not a primitive type (removes several
   reduce/reduce conflicts)
2. Being more specific about which linkage types are allowed for functions
   and global variables. In particular "appending" can no longer be 
   specified for a function. A differentiation was made between the various
   internal and external linkage types.
3. Introduced the "define" keyword which is now required when defining a
   function. This disambiguates several cases where a named function return 
   type could get confused with the definition of a new type. Using the
   keyword eliminates all shift/reduce conflicts and the remaining 
   reduce/reduce conflicts.

These changes are necessary to implement the function parameter attributes 
that will be introduced soon. Adding the function parameter attributes in
the presence of the shift/reduce and reduce/reduce conflicts led to severe
ambiguities that caused the parser to report syntax errors that needed to
be resolved. This patch resolves them.


---
Diffs of the changes:  (+3 -1)

 AsmWriter.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.230 llvm/lib/VMCore/AsmWriter.cpp:1.231
--- llvm/lib/VMCore/AsmWriter.cpp:1.230	Tue Dec 19 15:16:35 2006
+++ llvm/lib/VMCore/AsmWriter.cpp	Fri Dec 29 14:29:48 2006
@@ -921,7 +921,8 @@
     case GlobalValue::ExternalWeakLinkage: Out << "declare extern_weak "; break;
     default: Out << "declare ";
     }
-  else
+  else {
+    Out << "define ";
     switch (F->getLinkage()) {
     case GlobalValue::InternalLinkage:     Out << "internal "; break;
     case GlobalValue::LinkOnceLinkage:     Out << "linkonce "; break;
@@ -935,6 +936,7 @@
       cerr << "GhostLinkage not allowed in AsmWriter!\n";
       abort();
     }
+  }
 
   // Print the calling convention.
   switch (F->getCallingConv()) {






More information about the llvm-commits mailing list