changeset 480:fc12214ba4a1

Zero out padding of fp80.
author Christian Kamm <kamm incasoftware de>
date Tue, 05 Aug 2008 20:10:12 +0200
parents 672eb4893b55
children 18480579dc04
files gen/llvmhelpers.cpp
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Tue Aug 05 19:28:19 2008 +0200
+++ b/gen/llvmhelpers.cpp	Tue Aug 05 20:10:12 2008 +0200
@@ -91,11 +91,22 @@
 
 llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name)
 {
+    if(lltype == LLType::X86_FP80Ty)
+    {
+        llvm::AllocaInst* alloca = new llvm::AllocaInst(lltype, name, gIR->topallocapoint());
+        LLValue* castv = new llvm::BitCastInst(alloca, getPtrToType(LLType::Int16Ty), "fp80toi16", gIR->scopebb());
+        LLValue* padding = DtoGEPi1(castv, 5, "fp80padding");
+	new llvm::StoreInst(llvm::Constant::getNullValue(LLType::Int16Ty), padding, gIR->scopebb());
+
+        return alloca;
+    }
+
     return new llvm::AllocaInst(lltype, name, gIR->topallocapoint());
 }
 
 llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name)
 {
+    assert(lltype != LLType::X86_FP80Ty && "Zero-init of fp80 padding for array allocas not yet implemented");
     return new llvm::AllocaInst(lltype, arraysize, name, gIR->topallocapoint());
 }