[cfe-commits] r51446 - in /cfe/trunk/lib/CodeGen: CGDecl.cpp CGExpr.cpp CGExprAgg.cpp CGStmt.cpp CodeGenTypes.cpp

Dan Gohman gohman at apple.com
Thu May 22 15:12:56 PDT 2008


Author: djg
Date: Thu May 22 17:12:56 2008
New Revision: 51446

URL: http://llvm.org/viewvc/llvm-project?rev=51446&view=rev
Log:
Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.

Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=51446&r1=51445&r2=51446&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu May 22 17:12:56 2008
@@ -169,9 +169,9 @@
   } else if (Target.useGlobalsForAutomaticVariables()) {
     DeclPtr = GenerateStaticBlockVarDecl(D, true, ".arg.");
   } else {
-    // A fixed sized first class variable becomes an alloca in the entry block.
+    // A fixed sized single-value variable becomes an alloca in the entry block.
     const llvm::Type *LTy = ConvertType(Ty);
-    if (LTy->isFirstClassType()) {
+    if (LTy->isSingleValueType()) {
       // TODO: Alignment
       DeclPtr = new llvm::AllocaInst(LTy, 0, std::string(D.getName())+".addr",
                                      AllocaInsertPt);

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu May 22 17:12:56 2008
@@ -133,7 +133,7 @@
       cast<llvm::PointerType>(Ptr->getType())->getElementType();
     
     // Simple scalar l-value.
-    if (EltTy->isFirstClassType()) {
+    if (EltTy->isSingleValueType()) {
       llvm::Value *V = Builder.CreateLoad(Ptr, "tmp");
       
       // Bool can have different representation in memory than in registers.

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=51446&r1=51445&r2=51446&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 22 17:12:56 2008
@@ -298,7 +298,7 @@
     const llvm::Type *EType = AType->getElementType();
     for (/*Do not initialize i*/; i < NumArrayElements; ++i) {
       llvm::Value *NextVal = Builder.CreateStructGEP(DestPtr, i, ".array");
-      if (EType->isFirstClassType())
+      if (EType->isSingleValueType())
         Builder.CreateStore(llvm::Constant::getNullValue(EType), NextVal);
       else
         EmitAggregateClear(NextVal, QType);

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=51446&r1=51445&r2=51446&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Thu May 22 17:12:56 2008
@@ -688,7 +688,7 @@
     // If the first output operand is not a memory dest, we'll
     // make it the return value.
     if (i == 0 && !(Info & TargetInfo::CI_AllowsMemory) &&
-        DestValueType->isFirstClassType()) {
+        DestValueType->isSingleValueType()) {
       ResultAddr = Dest.getAddress();
       ResultType = DestValueType;
       Constraints += "=" + OutputConstraint;
@@ -709,10 +709,10 @@
       llvm::Value *Arg;
       if ((Info & TargetInfo::CI_AllowsRegister) ||
           !(Info & TargetInfo::CI_AllowsMemory)) {      
-        if (ConvertType(InputExpr->getType())->isFirstClassType()) {
+        if (ConvertType(InputExpr->getType())->isSingleValueType()) {
           Arg = EmitScalarExpr(InputExpr);
         } else {
-          assert(0 && "FIXME: Implement passing non first class types as inputs");
+          assert(0 && "FIXME: Implement passing multiple-value types as inputs");
         }
       } else {
         LValue Dest = EmitLValue(InputExpr);
@@ -750,10 +750,10 @@
     
     if ((Info & TargetInfo::CI_AllowsRegister) ||
         !(Info & TargetInfo::CI_AllowsMemory)) {      
-      if (ConvertType(InputExpr->getType())->isFirstClassType()) {
+      if (ConvertType(InputExpr->getType())->isSingleValueType()) {
         Arg = EmitScalarExpr(InputExpr);
       } else {
-        assert(0 && "FIXME: Implement passing non first class types as inputs");
+        assert(0 && "FIXME: Implement passing multiple-value types as inputs");
       }
     } else {
       LValue Dest = EmitLValue(InputExpr);

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=51446&r1=51445&r2=51446&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Thu May 22 17:12:56 2008
@@ -279,7 +279,7 @@
     std::vector<const llvm::Type*> ArgTys;
     
     // Struct return passes the struct byref.
-    if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
+    if (!ResultType->isSingleValueType() && ResultType != llvm::Type::VoidTy) {
       ArgTys.push_back(llvm::PointerType::get(ResultType, 
                                         FP.getResultType().getAddressSpace()));
       ResultType = llvm::Type::VoidTy;
@@ -352,7 +352,7 @@
                                        std::vector<const llvm::Type*> &ArgTys) {
   for (unsigned i = 0, e = FTP.getNumArgs(); i != e; ++i) {
     const llvm::Type *Ty = ConvertTypeRecursive(FTP.getArgType(i));
-    if (Ty->isFirstClassType())
+    if (Ty->isSingleValueType())
       ArgTys.push_back(Ty);
     else
       // byval arguments are always on the stack, which is addr space #0.





More information about the cfe-commits mailing list