[llvm-commits] [llvm-gcc-4.2] r113710 - in /llvm-gcc-4.2/trunk/gcc: config/arm/llvm-arm-target.h config/arm/llvm-arm.cpp llvm-abi-default.cpp llvm-abi.h llvm-convert.cpp llvm-types.cpp
Eric Christopher
echristo at apple.com
Sat Sep 11 20:26:36 PDT 2010
Author: echristo
Date: Sat Sep 11 22:26:36 2010
New Revision: 113710
URL: http://llvm.org/viewvc/llvm-project?rev=113710&view=rev
Log:
Revert 113694 in an attempt to fix the buildbots.
Modified:
llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h
llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h Sat Sep 11 22:26:36 2010
@@ -55,15 +55,6 @@
#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \
llvm_arm_should_pass_aggregate_in_mixed_regs((T), (TY), (CC), (E))
-struct DefaultABIClient;
-extern bool
-llvm_arm_try_pass_aggregate_custom(tree, std::vector<const Type*>&,
- CallingConv::ID&,
- struct DefaultABIClient*);
-
-#define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C) \
- llvm_arm_try_pass_aggregate_custom((T), (E), (CC), (C))
-
extern
bool llvm_arm_aggregate_partially_passed_in_regs(std::vector<const Type*>&,
std::vector<const Type*>&,
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Sat Sep 11 22:26:36 2010
@@ -2557,91 +2557,6 @@
}
}
-static unsigned count_num_words(std::vector<const Type*> &ScalarElts) {
- unsigned NumWords = 0;
- for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) {
- const Type *Ty = ScalarElts[i];
- if (Ty->isPointerTy()) {
- NumWords++;
- } else if (Ty->isIntegerTy()) {
- const unsigned TypeSize = Ty->getPrimitiveSizeInBits();
- const unsigned NumWordsForType = (TypeSize + 31) / 32;
-
- NumWords += NumWordsForType;
- } else {
- assert (0 && "Unexpected type.");
- }
- }
- return NumWords;
-}
-
-// This function is used only on AAPCS. The difference from the generic
-// handling of arguments is that arguments larger than 32 bits are split
-// and padding arguments are added as necessary for alignment. This makes
-// the IL a bit more explicit about how arguments are handled.
-extern bool
-llvm_arm_try_pass_aggregate_custom(tree type,
- std::vector<const Type*>& ScalarElts,
- CallingConv::ID& CC,
- struct DefaultABIClient* C) {
- if (CC != CallingConv::ARM_AAPCS && CC != CallingConv::C)
- return false;
-
- if (CC == CallingConv::C && !TARGET_AAPCS_BASED)
- return false;
-
- if (TARGET_HARD_FLOAT_ABI)
- return false;
- const Type *Ty = ConvertType(type);
- if (Ty->isPointerTy())
- return false;
-
- const unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
- const unsigned Alignment = TYPE_ALIGN(type)/8;
- const unsigned NumWords = count_num_words(ScalarElts);
- const bool AddPad = Alignment >= 8 && (NumWords % 2);
-
- // First, build a type that will be bitcast to the original one and
- // from where elements will be extracted.
- std::vector<const Type*> Elts;
- const Type* Int32Ty = Type::getInt32Ty(getGlobalContext());
- const unsigned NumRegularArgs = Size / 4;
- for (unsigned i = 0; i < NumRegularArgs; ++i) {
- Elts.push_back(Int32Ty);
- }
- const unsigned RestSize = Size % 4;
- const llvm::Type *RestType = NULL;
- if (RestSize> 2) {
- RestType = Type::getInt32Ty(getGlobalContext());
- } else if (RestSize > 1) {
- RestType = Type::getInt16Ty(getGlobalContext());
- } else if (RestSize > 0) {
- RestType = Type::getInt8Ty(getGlobalContext());
- }
- if (RestType)
- Elts.push_back(RestType);
- const StructType *STy = StructType::get(getGlobalContext(), Elts, false);
-
- if (AddPad) {
- ScalarElts.push_back(Int32Ty);
- C->HandlePad(Int32Ty);
- }
-
- for (unsigned i = 0; i < NumRegularArgs; ++i) {
- C->EnterField(i, STy);
- C->HandleScalarArgument(Int32Ty, 0);
- ScalarElts.push_back(Int32Ty);
- C->ExitField();
- }
- if (RestType) {
- C->EnterField(NumRegularArgs, STy);
- C->HandleScalarArgument(RestType, 0, RestSize);
- ScalarElts.push_back(RestType);
- C->ExitField();
- }
- return true;
-}
-
// Target hook for llvm-abi.h. It returns true if an aggregate of the
// specified type should be passed in a number of registers of mixed types.
// It also returns a vector of types that correspond to the registers used
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp Sat Sep 11 22:26:36 2010
@@ -8,8 +8,7 @@
/// return type. It potentially breaks down the argument and invokes methods
/// on the client that indicate how its pieces should be handled. This
/// handles things like returning structures via hidden parameters.
-void DefaultABI::HandleReturnType(tree type, tree fn, bool isBuiltin,
- std::vector<const Type*> &ScalarElts) {
+void DefaultABI::HandleReturnType(tree type, tree fn, bool isBuiltin) {
unsigned Offset = 0;
const Type *Ty = ConvertType(type);
if (Ty->isVectorTy()) {
@@ -53,9 +52,7 @@
// FIXME: should return the hidden first argument for some targets
// (e.g. ELF i386).
- const PointerType *PTy = Ty->getPointerTo();
- C.HandleAggregateShadowResult(PTy, false);
- ScalarElts.push_back(PTy);
+ C.HandleAggregateShadowResult(Ty->getPointerTo(), false);
}
}
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sat Sep 11 22:26:36 2010
@@ -396,8 +396,7 @@
/// return type. It potentially breaks down the argument and invokes methods
/// on the client that indicate how its pieces should be handled. This
/// handles things like returning structures via hidden parameters.
- void HandleReturnType(tree type, tree fn, bool isBuiltin,
- std::vector<const Type*> &ScalarElts);
+ void HandleReturnType(tree type, tree fn, bool isBuiltin);
/// HandleArgument - This is invoked by the target-independent code for each
/// argument type passed into the function. It potentially breaks down the
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Sep 11 22:26:36 2010
@@ -673,19 +673,17 @@
FunctionPrologArgumentConversion Client(FnDecl, AI, Builder, CallingConv);
DefaultABI ABIConverter(Client);
- // Scalar arguments processed so far.
- std::vector<const Type*> ScalarArgs;
-
// Handle the DECL_RESULT.
ABIConverter.HandleReturnType(TREE_TYPE(TREE_TYPE(FnDecl)), FnDecl,
- DECL_BUILT_IN(FnDecl),
- ScalarArgs);
+ DECL_BUILT_IN(FnDecl));
// Remember this for use by FinishFunctionBody.
ReturnOffset = Client.Offset;
// Prepend the static chain (if any) to the list of arguments.
tree Args = static_chain ? static_chain : DECL_ARGUMENTS(FnDecl);
+ // Scalar arguments processed so far.
+ std::vector<const Type*> ScalarArgs;
while (Args) {
const char *Name = "unnamed_arg";
if (DECL_NAME(Args)) Name = IDENTIFIER_POINTER(DECL_NAME(Args));
@@ -3014,17 +3012,16 @@
DefaultABI ABIConverter(Client);
// Handle the result, including struct returns.
- std::vector<const Type*> ScalarArgs;
ABIConverter.HandleReturnType(TREE_TYPE(exp),
fndecl ? fndecl : exp,
- fndecl ? DECL_BUILT_IN(fndecl) : false,
- ScalarArgs);
+ fndecl ? DECL_BUILT_IN(fndecl) : false);
// Pass the static chain, if any, as the first parameter.
if (TREE_OPERAND(exp, 2))
CallOperands.push_back(Emit(TREE_OPERAND(exp, 2), 0));
// Loop over the arguments, expanding them and adding them to the op list.
+ std::vector<const Type*> ScalarArgs;
for (tree arg = TREE_OPERAND(exp, 1); arg; arg = TREE_CHAIN(arg)) {
tree type = TREE_TYPE(TREE_VALUE(arg));
const Type *ArgTy = ConvertType(type);
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=113710&r1=113709&r2=113710&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Sep 11 22:26:36 2010
@@ -1082,10 +1082,8 @@
TARGET_ADJUST_LLVM_CC(CallingConv, type);
#endif
- std::vector<const Type*> ScalarArgs;
// Builtins are always prototyped, so this isn't one.
- ABIConverter.HandleReturnType(ReturnType, current_function_decl, false,
- ScalarArgs);
+ ABIConverter.HandleReturnType(ReturnType, current_function_decl, false);
SmallVector<AttributeWithIndex, 8> Attrs;
@@ -1112,6 +1110,7 @@
Attrs.push_back(AttributeWithIndex::get(ArgTys.size(),
Attribute::StructRet));
+ std::vector<const Type*> ScalarArgs;
if (static_chain) {
// Pass the static chain as the first parameter.
ABIConverter.HandleArgument(TREE_TYPE(static_chain), ScalarArgs);
@@ -1153,10 +1152,8 @@
TARGET_ADJUST_LLVM_CC(CallingConv, type);
#endif
- std::vector<const Type*> ScalarArgs;
ABIConverter.HandleReturnType(TREE_TYPE(type), current_function_decl,
- decl ? DECL_BUILT_IN(decl) : false,
- ScalarArgs);
+ decl ? DECL_BUILT_IN(decl) : false);
// Compute attributes for return type (and function attributes).
SmallVector<AttributeWithIndex, 8> Attrs;
@@ -1221,6 +1218,7 @@
Attrs.push_back(AttributeWithIndex::get(ArgTypes.size(),
Attribute::StructRet | Attribute::NoAlias));
+ std::vector<const Type*> ScalarArgs;
if (static_chain) {
// Pass the static chain as the first parameter.
ABIConverter.HandleArgument(TREE_TYPE(static_chain), ScalarArgs);
More information about the llvm-commits
mailing list