[llvm-commits] [dragonegg] r115772 - /dragonegg/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Wed Oct 6 03:04:21 PDT 2010
Author: baldrick
Date: Wed Oct 6 05:04:20 2010
New Revision: 115772
URL: http://llvm.org/viewvc/llvm-project?rev=115772&view=rev
Log:
Port commit 106225 (johannes) from llvm-gcc:
Inline asm: handle matching constraints on memory arguments. 8074175.
Modified:
dragonegg/trunk/llvm-convert.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=115772&r1=115771&r2=115772&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Wed Oct 6 05:04:20 2010
@@ -6815,6 +6815,7 @@
SmallVector<Value *, 4> StoreCallResultAddrs;
SmallVector<const Type *, 4> CallResultTypes;
SmallVector<bool, 4> CallResultIsSigned;
+ SmallVector<std::pair<bool, unsigned>, 4> OutputLocations;
SmallVector<tree, 4> CallResultSSANames;
SmallVector<MemRef, 4> CallResultSSATemps;
@@ -6894,11 +6895,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));
}
}
@@ -6970,8 +6973,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