barannikov88 updated this revision to Diff 518187. barannikov88 added a comment.
Upload the correct diff Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148093/new/ https://reviews.llvm.org/D148093 Files: clang/lib/CodeGen/ABIInfo.h clang/lib/CodeGen/TargetInfo.cpp Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -125,7 +125,7 @@ /// registers when expanded? /// /// This is intended to be the basis of a reasonable basic implementation -/// of should{Pass,Return}IndirectlyForSwift. +/// of should{Pass,Return}Indirectly. /// /// For most targets, a limit of four total registers is reasonable; this /// limits the amount of code required in order to move around the value @@ -134,15 +134,14 @@ /// immediately within the callee. But some targets may need to further /// limit the register count due to an inability to support that many /// return registers. -static bool occupiesMoreThan(CodeGenTypes &cgt, - ArrayRef<llvm::Type*> scalarTypes, - unsigned maxAllRegisters) { +bool SwiftABIInfo::occupiesMoreThan(ArrayRef<llvm::Type *> scalarTypes, + unsigned maxAllRegisters) const { unsigned intCount = 0, fpCount = 0; for (llvm::Type *type : scalarTypes) { if (type->isPointerTy()) { intCount++; } else if (auto intTy = dyn_cast<llvm::IntegerType>(type)) { - auto ptrWidth = cgt.getTarget().getPointerWidth(LangAS::Default); + auto ptrWidth = CGT.getTarget().getPointerWidth(LangAS::Default); intCount += (intTy->getBitWidth() + ptrWidth - 1) / ptrWidth; } else { assert(type->isVectorTy() || type->isFloatingPointTy()); @@ -155,7 +154,7 @@ bool SwiftABIInfo::shouldPassIndirectly(ArrayRef<llvm::Type *> ComponentTys, bool AsReturnValue) const { - return occupiesMoreThan(CGT, ComponentTys, /*total=*/4); + return occupiesMoreThan(ComponentTys, /*total=*/4); } bool SwiftABIInfo::isLegalVectorType(CharUnits VectorSize, llvm::Type *EltTy, @@ -1246,7 +1245,7 @@ // integer registers and three fp registers. Oddly, it'll use up to // four vector registers for vectors, but those can overlap with the // scalar registers. - return occupiesMoreThan(CGT, ComponentTys, /*total=*/3); + return occupiesMoreThan(ComponentTys, /*total=*/3); } }; Index: clang/lib/CodeGen/ABIInfo.h =================================================================== --- clang/lib/CodeGen/ABIInfo.h +++ clang/lib/CodeGen/ABIInfo.h @@ -120,6 +120,9 @@ CodeGenTypes &CGT; bool SwiftErrorInRegister; + bool occupiesMoreThan(ArrayRef<llvm::Type *> scalarTypes, + unsigned maxAllRegisters) const; + public: SwiftABIInfo(CodeGen::CodeGenTypes &CGT, bool SwiftErrorInRegister) : CGT(CGT), SwiftErrorInRegister(SwiftErrorInRegister) {}
Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -125,7 +125,7 @@ /// registers when expanded? /// /// This is intended to be the basis of a reasonable basic implementation -/// of should{Pass,Return}IndirectlyForSwift. +/// of should{Pass,Return}Indirectly. /// /// For most targets, a limit of four total registers is reasonable; this /// limits the amount of code required in order to move around the value @@ -134,15 +134,14 @@ /// immediately within the callee. But some targets may need to further /// limit the register count due to an inability to support that many /// return registers. -static bool occupiesMoreThan(CodeGenTypes &cgt, - ArrayRef<llvm::Type*> scalarTypes, - unsigned maxAllRegisters) { +bool SwiftABIInfo::occupiesMoreThan(ArrayRef<llvm::Type *> scalarTypes, + unsigned maxAllRegisters) const { unsigned intCount = 0, fpCount = 0; for (llvm::Type *type : scalarTypes) { if (type->isPointerTy()) { intCount++; } else if (auto intTy = dyn_cast<llvm::IntegerType>(type)) { - auto ptrWidth = cgt.getTarget().getPointerWidth(LangAS::Default); + auto ptrWidth = CGT.getTarget().getPointerWidth(LangAS::Default); intCount += (intTy->getBitWidth() + ptrWidth - 1) / ptrWidth; } else { assert(type->isVectorTy() || type->isFloatingPointTy()); @@ -155,7 +154,7 @@ bool SwiftABIInfo::shouldPassIndirectly(ArrayRef<llvm::Type *> ComponentTys, bool AsReturnValue) const { - return occupiesMoreThan(CGT, ComponentTys, /*total=*/4); + return occupiesMoreThan(ComponentTys, /*total=*/4); } bool SwiftABIInfo::isLegalVectorType(CharUnits VectorSize, llvm::Type *EltTy, @@ -1246,7 +1245,7 @@ // integer registers and three fp registers. Oddly, it'll use up to // four vector registers for vectors, but those can overlap with the // scalar registers. - return occupiesMoreThan(CGT, ComponentTys, /*total=*/3); + return occupiesMoreThan(ComponentTys, /*total=*/3); } }; Index: clang/lib/CodeGen/ABIInfo.h =================================================================== --- clang/lib/CodeGen/ABIInfo.h +++ clang/lib/CodeGen/ABIInfo.h @@ -120,6 +120,9 @@ CodeGenTypes &CGT; bool SwiftErrorInRegister; + bool occupiesMoreThan(ArrayRef<llvm::Type *> scalarTypes, + unsigned maxAllRegisters) const; + public: SwiftABIInfo(CodeGen::CodeGenTypes &CGT, bool SwiftErrorInRegister) : CGT(CGT), SwiftErrorInRegister(SwiftErrorInRegister) {}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits