[llvm-commits] [llvm-gcc-4.2] r106225 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Dale Johannesen
dalej at apple.com
Thu Jun 17 10:42:35 PDT 2010
Author: johannes
Date: Thu Jun 17 12:42:34 2010
New Revision: 106225
URL: http://llvm.org/viewvc/llvm-project?rev=106225&view=rev
Log:
Inline asm: handle matching constraints on memory arguments. 8074175.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
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=106225&r1=106224&r2=106225&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jun 17 12:42:34 2010
@@ -4696,6 +4696,7 @@
SmallVector<Value *, 4> StoreCallResultAddrs;
SmallVector<const Type *, 4> CallResultTypes;
SmallVector<bool, 4> CallResultIsSigned;
+ SmallVector<std::pair<bool, unsigned>, 4> OutputLocations;
// Process outputs.
ValNum = 0;
@@ -4763,11 +4764,13 @@
ConstraintStr += SimplifiedConstraint;
CallResultTypes.push_back(DestValTy);
CallResultIsSigned.push_back(!TYPE_UNSIGNED(TREE_TYPE(Operand)));
+ OutputLocations.push_back(std::make_pair(true, CallResultTypes.size()-1));
} else {
ConstraintStr += ",=*";
ConstraintStr += SimplifiedConstraint;
CallOps.push_back(Dest.Ptr);
CallArgTypes.push_back(Dest.Ptr->getType());
+ OutputLocations.push_back(std::make_pair(false, CallArgTypes.size()-1));
}
}
@@ -4832,8 +4835,19 @@
// is big endian.
if (ISDIGIT(Constraint[0])) {
unsigned Match = atoi(Constraint);
- const Type *OTy = (Match < CallResultTypes.size())
- ? CallResultTypes[Match] : 0;
+ // This output might have gotten put in either CallResult or CallArg
+ // depending whether it's a register or not. Find its type.
+ const Type *OTy = 0;
+ if (Match < OutputLocations.size()) {
+ // Indices here known to be within range.
+ if (OutputLocations[Match].first)
+ OTy = CallResultTypes[OutputLocations[Match].second];
+ else {
+ OTy = CallArgTypes[OutputLocations[Match].second];
+ assert(OTy->isPointerTy() && "Expected pointer type!");
+ OTy = cast<PointerType>(OTy)->getElementType();
+ }
+ }
if (OTy && OTy != OpTy) {
if (!(OTy->isIntegerTy() || OTy->isPointerTy()) ||
!(OpTy->isIntegerTy() || OpTy->isPointerTy())) {
More information about the llvm-commits
mailing list