aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/ConstantWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-15 00:17:23 +0000
committerChris Lattner <sabre@nondot.org>2001-07-15 00:17:23 +0000
commitff5eccef96fa0344b0b6035da543640c2e885b75 (patch)
tree2fab47e056bab15f11a23bbb2973f4bd7b08fcb0 /lib/Bytecode/Writer/ConstantWriter.cpp
parenta1375303415f645af6900d0a7141411e8ffbd430 (diff)
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
Diffstat (limited to 'lib/Bytecode/Writer/ConstantWriter.cpp')
-rw-r--r--lib/Bytecode/Writer/ConstantWriter.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index 5ca0fca0d1..7e2c9307b9 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -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: