[cfe-commits] r41908 - /cfe/trunk/CodeGen/CGExprScalar.cpp
Chris Lattner
sabre at nondot.org
Wed Sep 12 18:26:12 PDT 2007
Author: lattner
Date: Wed Sep 12 20:26:11 2007
New Revision: 41908
URL: http://llvm.org/viewvc/llvm-project?rev=41908&view=rev
Log:
adjust to a change in the LLVM APIs, this is still very hackish until
the front-end adopts APFloat though. This fixes test/CodeGen/mandel.c
Modified:
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=41908&r1=41907&r2=41908&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Wed Sep 12 20:26:11 2007
@@ -93,7 +93,13 @@
return llvm::ConstantInt::get(E->getValue());
}
Value *VisitFloatingLiteral(const FloatingLiteral *E) {
- return llvm::ConstantFP::get(ConvertType(E->getType()), E->getValue());
+ double V = E->getValue();
+ // FIXME: Change this when FloatingLiteral uses an APFloat internally.
+ const llvm::Type *Ty = ConvertType(E->getType());
+ if (Ty == llvm::Type::FloatTy)
+ return llvm::ConstantFP::get(Ty, llvm::APFloat((float)V));
+ assert(Ty == llvm::Type::DoubleTy && "Unknown float type!");
+ return llvm::ConstantFP::get(Ty, llvm::APFloat((double)V));
}
Value *VisitCharacterLiteral(const CharacterLiteral *E) {
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
More information about the cfe-commits
mailing list