summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-03 17:51:03 +0000
committerChris Lattner <sabre@nondot.org>2007-08-03 17:51:03 +0000
commit4048005ad819c9f6e123d78c6ff3a2d7ecdb1123 (patch)
tree35a24d9acc19c31ea1850a831bf4dd577bb7f032
parent477ac778ed2b2f2a5f1f1e77b2eff9fff69946f0 (diff)
downloadbcm5719-llvm-4048005ad819c9f6e123d78c6ff3a2d7ecdb1123.tar.gz
bcm5719-llvm-4048005ad819c9f6e123d78c6ff3a2d7ecdb1123.zip
implement codegen support for __builtin_types_compatible_p
llvm-svn: 40788
-rw-r--r--clang/CodeGen/CGExpr.cpp8
-rw-r--r--clang/CodeGen/CodeGenFunction.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/CodeGen/CGExpr.cpp b/clang/CodeGen/CGExpr.cpp
index 3cae677cd0c..9697686b1a7 100644
--- a/clang/CodeGen/CGExpr.cpp
+++ b/clang/CodeGen/CGExpr.cpp
@@ -614,6 +614,8 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
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 @@ RValue CodeGenFunction::EmitCharacterLiteral(const CharacterLiteral *E) {
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
diff --git a/clang/CodeGen/CodeGenFunction.h b/clang/CodeGen/CodeGenFunction.h
index 3235034a0ba..4c79498c462 100644
--- a/clang/CodeGen/CodeGenFunction.h
+++ b/clang/CodeGen/CodeGenFunction.h
@@ -48,6 +48,8 @@ namespace clang {
class IntegerLiteral;
class FloatingLiteral;
class CharacterLiteral;
+ class TypesCompatibleExpr;
+
class CastExpr;
class CallExpr;
class UnaryOperator;
@@ -351,6 +353,7 @@ public:
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);
OpenPOWER on IntegriCloud