[llvm-commits] [llvm] r47857 - in /llvm/trunk: include/llvm/Function.h include/llvm/Instructions.h lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Transforms/IPO/DeadArgumentElimination.cpp lib/Transforms/IPO/StructRetPromotion.cpp lib/VMCore/Function.cpp lib/VMCore/Instructions.cpp lib/VMCore/Verifier.cpp
Devang Patel
dpatel at apple.com
Mon Mar 3 13:46:28 PST 2008
Author: dpatel
Date: Mon Mar 3 15:46:28 2008
New Revision: 47857
URL: http://llvm.org/viewvc/llvm-project?rev=47857&view=rev
Log:
s/isReturnStruct()/hasStructRetAttr()/g
Modified:
llvm/trunk/include/llvm/Function.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/Target/CBackend/CBackend.cpp
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Mon Mar 3 15:46:28 2008
@@ -181,8 +181,9 @@
/// @brief Determine if the function does not access or only reads memory.
bool onlyReadsMemory() const;
- /// @brief Determine if the function returns a structure.
- bool isStructReturn() const;
+ /// @brief Determine if the function returns a structure through first
+ /// pointer argument.
+ bool hasStructRetAttr() const;
/// deleteBody - This method deletes the body of the function, and converts
/// the linkage to external.
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Mar 3 15:46:28 2008
@@ -957,8 +957,9 @@
bool doesNotThrow() const;
void setDoesNotThrow(bool doesNotThrow = true);
- /// @brief Determine if the call returns a structure.
- bool isStructReturn() const;
+ /// @brief Determine if the call returns a structure through first
+ /// pointer argument.
+ bool hasStructRetAttr() const;
/// @brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const;
@@ -1769,8 +1770,9 @@
bool doesNotThrow() const;
void setDoesNotThrow(bool doesNotThrow = true);
- /// @brief Determine if the call returns a structure.
- bool isStructReturn() const;
+ /// @brief Determine if the call returns a structure through first
+ /// pointer argument.
+ bool hasStructRetAttr() const;
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Mar 3 15:46:28 2008
@@ -1904,7 +1904,7 @@
void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
/// isStructReturn - Should this function actually return a struct by-value?
- bool isStructReturn = F->isStructReturn();
+ bool isStructReturn = F->hasStructRetAttr();
if (F->hasInternalLinkage()) Out << "static ";
if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
@@ -2024,7 +2024,7 @@
void CWriter::printFunction(Function &F) {
/// isStructReturn - Should this function actually return a struct by-value?
- bool isStructReturn = F.isStructReturn();
+ bool isStructReturn = F.hasStructRetAttr();
printFunctionSignature(&F, false);
Out << " {\n";
@@ -2148,7 +2148,7 @@
//
void CWriter::visitReturnInst(ReturnInst &I) {
// If this is a struct return function, return the temporary struct.
- bool isStructReturn = I.getParent()->getParent()->isStructReturn();
+ bool isStructReturn = I.getParent()->getParent()->hasStructRetAttr();
if (isStructReturn) {
Out << " return StructReturn;\n";
@@ -2584,7 +2584,7 @@
// parameter instead of passing it to the call.
const ParamAttrsList *PAL = I.getParamAttrs();
bool hasByVal = I.hasByValArgument();
- bool isStructRet = I.isStructReturn();
+ bool isStructRet = I.hasStructRetAttr();
if (isStructRet) {
writeOperandDeref(I.getOperand(1));
Out << " = ";
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 3 15:46:28 2008
@@ -102,13 +102,13 @@
case StdCall:
// "Pure" variadic functions do not receive @0 suffix.
if (!FT->isVarArg() || (FT->getNumParams() == 0) ||
- (FT->getNumParams() == 1 && F->isStructReturn()))
+ (FT->getNumParams() == 1 && F->hasStructRetAttr()))
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
break;
case FastCall:
// "Pure" variadic functions do not receive @0 suffix.
if (!FT->isVarArg() || (FT->getNumParams() == 0) ||
- (FT->getNumParams() == 1 && F->isStructReturn()))
+ (FT->getNumParams() == 1 && F->hasStructRetAttr()))
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
if (Name[0] == '_') {
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Mar 3 15:46:28 2008
@@ -255,7 +255,7 @@
const Function *F = A.getParent();
// If this is the return value of a struct function, it's not really dead.
- if (F->isStructReturn() && &*(F->arg_begin()) == &A)
+ if (F->hasStructRetAttr() && &*(F->arg_begin()) == &A)
return Live;
if (A.use_empty()) // First check, directly dead?
Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Mon Mar 3 15:46:28 2008
@@ -75,7 +75,7 @@
return false;
// Make sure that function returns struct.
- if (F->arg_size() == 0 || !F->isStructReturn() || F->doesNotReturn())
+ if (F->arg_size() == 0 || !F->hasStructRetAttr() || F->doesNotReturn())
return false;
assert (F->getReturnType() == Type::VoidTy && "Invalid function return type");
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Mon Mar 3 15:46:28 2008
@@ -168,10 +168,10 @@
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
-/// @brief Determine if the function returns a structure.
-bool Function::isStructReturn() const {
- return paramHasAttr(1, ParamAttr::StructRet)
- || isa<StructType>(getReturnType());
+/// @brief Determine if the function returns a structure through first
+/// pointer argument.
+bool Function::hasStructRetAttr() const {
+ return paramHasAttr(1, ParamAttr::StructRet);
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Mar 3 15:46:28 2008
@@ -419,8 +419,9 @@
return paramHasAttr(0, ParamAttr::NoUnwind);
}
-/// @brief Determine if the call returns a structure.
-bool CallInst::isStructReturn() const {
+/// @brief Determine if the call returns a structure through first
+/// pointer argument.
+bool CallInst::hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
@@ -560,8 +561,9 @@
setParamAttrs(PAL);
}
-/// @brief Determine if the call returns a structure.
-bool InvokeInst::isStructReturn() const {
+/// @brief Determine if the invoke returns a structure through first
+/// pointer argument.
+bool InvokeInst::hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=47857&r1=47856&r2=47857&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Mar 3 15:46:28 2008
@@ -455,6 +455,9 @@
isa<StructType>(F.getReturnType()),
"Functions cannot return aggregate values!", &F);
+ Assert1(!F.hasStructRetAttr() || F.getReturnType() == Type::VoidTy,
+ "Invalid struct return type!", &F);
+
const ParamAttrsList *Attrs = F.getParamAttrs();
Assert1(!Attrs ||
More information about the llvm-commits
mailing list