Author: rnk Date: Tue Apr 30 15:23:20 2019 New Revision: 359623 URL: http://llvm.org/viewvc/llvm-project?rev=359623&view=rev Log: Remove two unnecessary wrappers of canPassInRegisters
These extra layers aren't necessary. Modified: cfe/trunk/lib/CodeGen/CGCXXABI.cpp cfe/trunk/lib/CodeGen/CGCXXABI.h cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Modified: cfe/trunk/lib/CodeGen/CGCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.cpp?rev=359623&r1=359622&r2=359623&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCXXABI.cpp Tue Apr 30 15:23:20 2019 @@ -28,12 +28,6 @@ void CGCXXABI::ErrorUnsupportedABI(CodeG << S; } -bool CGCXXABI::canCopyArgument(const CXXRecordDecl *RD) const { - // We can only copy the argument if there exists at least one trivial, - // non-deleted copy or move constructor. - return RD->canPassInRegisters(); -} - llvm::Constant *CGCXXABI::GetBogusMemberPointer(QualType T) { return llvm::Constant::getNullValue(CGM.getTypes().ConvertType(T)); } Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.h?rev=359623&r1=359622&r2=359623&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGCXXABI.h (original) +++ cfe/trunk/lib/CodeGen/CGCXXABI.h Tue Apr 30 15:23:20 2019 @@ -136,10 +136,6 @@ public: RAA_Indirect }; - /// Returns true if C++ allows us to copy the memory of an object of type RD - /// when it is passed as an argument. - bool canCopyArgument(const CXXRecordDecl *RD) const; - /// Returns how an argument of the given record type should be passed. virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const = 0; Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=359623&r1=359622&r2=359623&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Tue Apr 30 15:23:20 2019 @@ -62,13 +62,9 @@ public: bool classifyReturnType(CGFunctionInfo &FI) const override; - bool passClassIndirect(const CXXRecordDecl *RD) const { - return !canCopyArgument(RD); - } - RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const override { // If C++ prohibits us from making a copy, pass by address. - if (passClassIndirect(RD)) + if (!RD->canPassInRegisters()) return RAA_Indirect; return RAA_Default; } @@ -1093,7 +1089,7 @@ bool ItaniumCXXABI::classifyReturnType(C return false; // If C++ prohibits us from making a copy, return by address. - if (passClassIndirect(RD)) { + if (!RD->canPassInRegisters()) { auto Align = CGM.getContext().getTypeAlignInChars(FI.getReturnType()); FI.getReturnInfo() = ABIArgInfo::getIndirect(Align, /*ByVal=*/false); return true; Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=359623&r1=359622&r2=359623&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Tue Apr 30 15:23:20 2019 @@ -811,7 +811,7 @@ MicrosoftCXXABI::getRecordArgABI(const C // Use the simple Itanium rules for now. // FIXME: This is incompatible with MSVC for arguments with a dtor and no // copy ctor. - return !canCopyArgument(RD) ? RAA_Indirect : RAA_Default; + return !RD->canPassInRegisters() ? RAA_Indirect : RAA_Default; case llvm::Triple::x86: // All record arguments are passed in memory on x86. Decide whether to @@ -820,7 +820,7 @@ MicrosoftCXXABI::getRecordArgABI(const C // If C++ prohibits us from making a copy, construct the arguments directly // into argument memory. - if (!canCopyArgument(RD)) + if (!RD->canPassInRegisters()) return RAA_DirectInMemory; // Otherwise, construct the argument into a temporary and copy the bytes @@ -829,7 +829,7 @@ MicrosoftCXXABI::getRecordArgABI(const C case llvm::Triple::x86_64: case llvm::Triple::aarch64: - return !canCopyArgument(RD) ? RAA_Indirect : RAA_Default; + return !RD->canPassInRegisters() ? RAA_Indirect : RAA_Default; } llvm_unreachable("invalid enum"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits