Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.47 -> 1.48
---
Log message:

implement reading/writing of inlineasm objects


---
Diffs of the changes:  (+16 -6)

 BitcodeWriter.cpp |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.48
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47      Sat May  5 20:28:01 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 20:58:20 2007
@@ -17,6 +17,7 @@
 #include "ValueEnumerator.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/InlineAsm.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
 #include "llvm/ParameterAttributes.h"
@@ -446,9 +447,6 @@
     CString6Abbrev = Stream.EmitAbbrev(Abbv);
   }  
   
-  // FIXME: Install and use abbrevs to reduce size.  Install them globally so
-  // they don't need to be reemitted for each function body.
-  
   SmallVector<uint64_t, 64> Record;
 
   const ValueEnumerator::ValueList &Vals = VE.getValues();
@@ -465,7 +463,21 @@
     }
     
     if (const InlineAsm *IA = dyn_cast<InlineAsm>(V)) {
-      assert(0 && IA && "FIXME: Inline asm writing unimp!");
+      Record.push_back(unsigned(IA->hasSideEffects()));
+      
+      // Add the asm string.
+      const std::string &AsmStr = IA->getAsmString();
+      Record.push_back(AsmStr.size());
+      for (unsigned i = 0, e = AsmStr.size(); i != e; ++i)
+        Record.push_back(AsmStr[i]);
+      
+      // Add the constraint string.
+      const std::string &ConstraintStr = IA->getConstraintString();
+      Record.push_back(ConstraintStr.size());
+      for (unsigned i = 0, e = ConstraintStr.size(); i != e; ++i)
+        Record.push_back(ConstraintStr[i]);
+      Stream.EmitRecord(bitc::CST_CODE_INLINEASM, Record);
+      Record.clear();
       continue;
     }
     const Constant *C = cast<Constant>(V);
@@ -894,8 +906,6 @@
   Stream.EmitRecord(bitc::FUNC_CODE_DECLAREBLOCKS, Vals);
   Vals.clear();
   
-  // FIXME: Function attributes?
-  
   // If there are function-local constants, emit them now.
   unsigned CstStart, CstEnd;
   VE.getFunctionConstantRange(CstStart, CstEnd);



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to