summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
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
commit4d44c2ba81749a5c1dfcaed7de58ef12efd6d2a2 (patch)
treee968f15ebc77c8c0866b2a273d691a64ea8c4eda /llvm/lib/Bytecode
parentf435e200b1e5c6f7426b34f2fede8dd5b4e95b46 (diff)
downloadbcm5719-llvm-4d44c2ba81749a5c1dfcaed7de58ef12efd6d2a2.tar.gz
bcm5719-llvm-4d44c2ba81749a5c1dfcaed7de58ef12efd6d2a2.zip
Add support to the bytecode writer to recognize floating point constants
llvm-svn: 190
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Writer/ConstantWriter.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp b/llvm/lib/Bytecode/Writer/ConstantWriter.cpp
index 5ca0fca0d12..7e2c9307b99 100644
--- a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/llvm/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:
OpenPOWER on IntegriCloud