Add support to the bytecode writer to recognize floating point constants
authorChris Lattner <sabre@nondot.org>
Sun, 15 Jul 2001 00:17:23 +0000 (00:17 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 15 Jul 2001 00:17:23 +0000 (00:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Writer/ConstantWriter.cpp

index 5ca0fca0d1219c56356ad9cc6d7fc1e9ec16fad2..7e2c9307b992a133b6f793a51189ec1710c6f7e9 100644 (file)
@@ -138,10 +138,16 @@ bool BytecodeWriter::outputConstant(const ConstPoolVal *CPV) {
     break;
   }
 
-  case Type::FloatTyID:    // Floating point types...
-  case Type::DoubleTyID:
-    // TODO: Floating point type serialization
-
+  case Type::FloatTyID: {   // Floating point types...
+    float Tmp = (float)((const ConstPoolFP*)CPV)->getValue();
+    output_data(&Tmp, &Tmp+1, Out);
+    break;
+  }
+  case Type::DoubleTyID: {
+    double Tmp = ((const ConstPoolFP*)CPV)->getValue();
+    output_data(&Tmp, &Tmp+1, Out);
+    break;
+  }
 
   case Type::VoidTyID: 
   case Type::LabelTyID: