Add support to the bytecode writer to recognize floating point constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index 5ca0fca..7e2c930 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -138,10 +138,16 @@
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: