From ff5eccef96fa0344b0b6035da543640c2e885b75 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Jul 2001 00:17:23 +0000 Subject: [PATCH] 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 --- lib/Bytecode/Writer/ConstantWriter.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp index 5ca0fca0d12..7e2c9307b99 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: