[cfe-commits] r39718 - in /cfe/cfe/trunk/CodeGen: CGExpr.cpp CodeGenFunction.h

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:47:30 PDT 2007


Author: clattner
Date: Wed Jul 11 11:47:29 2007
New Revision: 39718

URL: http://llvm.org/viewvc/llvm-project?rev=39718&view=rev
Log:
implement codegen support for FP literals

Modified:
    cfe/cfe/trunk/CodeGen/CGExpr.cpp
    cfe/cfe/trunk/CodeGen/CodeGenFunction.h

Modified: cfe/cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CGExpr.cpp?rev=39718&r1=39717&r2=39718&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CGExpr.cpp Wed Jul 11 11:47:29 2007
@@ -432,6 +432,8 @@
   // Leaf expressions.
   case Expr::IntegerLiteralClass:
     return EmitIntegerLiteral(cast<IntegerLiteral>(E)); 
+  case Expr::FloatingLiteralClass:
+    return EmitFloatingLiteral(cast<FloatingLiteral>(E));
     
   // Operators.  
   case Expr::ParenExprClass:
@@ -451,6 +453,10 @@
 RValue CodeGenFunction::EmitIntegerLiteral(const IntegerLiteral *E) {
   return RValue::get(llvm::ConstantInt::get(E->getValue()));
 }
+RValue CodeGenFunction::EmitFloatingLiteral(const FloatingLiteral *E) {
+  return RValue::get(llvm::ConstantFP::get(ConvertType(E->getType()),
+                                           E->getValue()));
+}
 
 RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
   QualType SrcTy;

Modified: cfe/cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenFunction.h?rev=39718&r1=39717&r2=39718&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenFunction.h Wed Jul 11 11:47:29 2007
@@ -45,6 +45,7 @@
   class DeclRefExpr;
   class StringLiteral;
   class IntegerLiteral;
+  class FloatingLiteral;
   class CastExpr;
   class CallExpr;
   class UnaryOperator;
@@ -280,6 +281,7 @@
   
   RValue EmitExpr(const Expr *E);
   RValue EmitIntegerLiteral(const IntegerLiteral *E);
+  RValue EmitFloatingLiteral(const FloatingLiteral *E);
   
   RValue EmitCastExpr(const CastExpr *E);
   RValue EmitCallExpr(const CallExpr *E);





More information about the cfe-commits mailing list