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

Chris Lattner sabre at nondot.org
Fri Aug 3 10:51:07 PDT 2007


Author: lattner
Date: Fri Aug  3 12:51:03 2007
New Revision: 40788

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

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

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

==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Fri Aug  3 12:51:03 2007
@@ -614,6 +614,8 @@
     return EmitFloatingLiteral(cast<FloatingLiteral>(E));
   case Expr::CharacterLiteralClass:
     return EmitCharacterLiteral(cast<CharacterLiteral>(E));
+  case Expr::TypesCompatibleExprClass:
+    return EmitTypesCompatibleExpr(cast<TypesCompatibleExpr>(E));
     
   // Operators.  
   case Expr::ParenExprClass:
@@ -651,6 +653,12 @@
                                             E->getValue()));
 }
 
+RValue CodeGenFunction::EmitTypesCompatibleExpr(const TypesCompatibleExpr *E) {
+  return RValue::get(llvm::ConstantInt::get(ConvertType(E->getType()),
+                                            E->typesAreCompatible()));
+}
+
+
 RValue CodeGenFunction::EmitArraySubscriptExprRV(const ArraySubscriptExpr *E) {
   // Emit subscript expressions in rvalue context's.  For most cases, this just
   // loads the lvalue formed by the subscript expr.  However, we have to be

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

==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.h Fri Aug  3 12:51:03 2007
@@ -48,6 +48,8 @@
   class IntegerLiteral;
   class FloatingLiteral;
   class CharacterLiteral;
+  class TypesCompatibleExpr;
+  
   class CastExpr;
   class CallExpr;
   class UnaryOperator;
@@ -351,6 +353,7 @@
   RValue EmitIntegerLiteral(const IntegerLiteral *E);
   RValue EmitFloatingLiteral(const FloatingLiteral *E);
   RValue EmitCharacterLiteral(const CharacterLiteral *E);
+  RValue EmitTypesCompatibleExpr(const TypesCompatibleExpr *E);
    
   RValue EmitCastExpr(const Expr *Op, QualType DestTy);
   RValue EmitCallExpr(const CallExpr *E);





More information about the cfe-commits mailing list