[llvm-commits] [llvm] r55657 - in /llvm/trunk: lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp test/Assembler/2008-09-02-FunctionNotes.ll

Devang Patel dpatel at apple.com
Tue Sep 2 14:47:14 PDT 2008


Author: dpatel
Date: Tue Sep  2 16:47:13 2008
New Revision: 55657

URL: http://llvm.org/viewvc/llvm-project?rev=55657&view=rev
Log:
Read and write function notes.

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=55657&r1=55656&r2=55657&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Sep  2 16:47:13 2008
@@ -1197,6 +1197,9 @@
           return Error("Invalid GC ID");
         Func->setGC(GCTable[Record[8]-1].c_str());
       }
+      if (!isProto && Record.size() > 9 && Record[9]) {
+        Func->setNotes(Record[9]);
+      }
       
       ValueList.push_back(Func);
       

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=55657&r1=55656&r2=55657&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep  2 16:47:13 2008
@@ -412,6 +412,7 @@
     Vals.push_back(F->hasSection() ? SectionMap[F->getSection()] : 0);
     Vals.push_back(getEncodedVisibility(F));
     Vals.push_back(F->hasGC() ? GCMap[F->getGC()] : 0);
+    Vals.push_back(F->getNotes());
     
     unsigned AbbrevToUse = 0;
     Stream.EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);

Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll?rev=55657&r1=55656&r2=55657&view=diff

==============================================================================
--- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll (original)
+++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll Tue Sep  2 16:47:13 2008
@@ -1,5 +1,5 @@
 ; Test function notes
-; RUN: llvm-as < %s -f -o /dev/null
+; RUN: llvm-as < %s | llvm-dis | grep inline | count 2
 
 define void @fn1() notes(inline=always) {
   ret void
@@ -9,3 +9,6 @@
   ret void
 }
 
+define void @fn3() {
+  ret void
+}





More information about the llvm-commits mailing list