Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 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 |
comparison
equal
deleted
inserted
replaced
479:672eb4893b55 | 480:fc12214ba4a1 |
---|---|
89 ////////////////////////////////////////////////////////////////////////////////////////*/ | 89 ////////////////////////////////////////////////////////////////////////////////////////*/ |
90 | 90 |
91 | 91 |
92 llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name) | 92 llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name) |
93 { | 93 { |
94 if(lltype == LLType::X86_FP80Ty) | |
95 { | |
96 llvm::AllocaInst* alloca = new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); | |
97 LLValue* castv = new llvm::BitCastInst(alloca, getPtrToType(LLType::Int16Ty), "fp80toi16", gIR->scopebb()); | |
98 LLValue* padding = DtoGEPi1(castv, 5, "fp80padding"); | |
99 new llvm::StoreInst(llvm::Constant::getNullValue(LLType::Int16Ty), padding, gIR->scopebb()); | |
100 | |
101 return alloca; | |
102 } | |
103 | |
94 return new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); | 104 return new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); |
95 } | 105 } |
96 | 106 |
97 llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name) | 107 llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name) |
98 { | 108 { |
109 assert(lltype != LLType::X86_FP80Ty && "Zero-init of fp80 padding for array allocas not yet implemented"); | |
99 return new llvm::AllocaInst(lltype, arraysize, name, gIR->topallocapoint()); | 110 return new llvm::AllocaInst(lltype, arraysize, name, gIR->topallocapoint()); |
100 } | 111 } |
101 | 112 |
102 | 113 |
103 /****************************************************************************************/ | 114 /****************************************************************************************/ |