[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 16 22:00:52 PST 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
TargetLowering.cpp updated: 1.91 -> 1.92
---
Log message:
Implement i/n/s constraints correctly. This fixes
test/CodeGen/PowerPC/2007-02-16-InlineAsmNConstraint.ll
---
Diffs of the changes: (+16 -2)
TargetLowering.cpp | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.91 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.92
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.91 Wed Feb 14 20:26:10 2007
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sat Feb 17 00:00:35 2007
@@ -1856,12 +1856,26 @@
char ConstraintLetter,
SelectionDAG &DAG) {
switch (ConstraintLetter) {
- default: return SDOperand(0,0);
+ default: break;
case 'i': // Simple Integer or Relocatable Constant
case 'n': // Simple Integer
case 's': // Relocatable Constant
- return Op; // FIXME: not right.
+ // These are okay if the operand is either a global variable address or a
+ // simple immediate value. If we have one of these, map to the TargetXXX
+ // version so that the value itself doesn't get selected.
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
+ // Simple constants are not allowed for 's'.
+ if (ConstraintLetter != 's')
+ return DAG.getTargetConstant(C->getValue(), Op.getValueType());
+ }
+ if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Op)) {
+ if (ConstraintLetter != 'n')
+ return DAG.getTargetGlobalAddress(GA->getGlobal(), Op.getValueType(),
+ GA->getOffset());
+ }
+ break;
}
+ return SDOperand(0,0);
}
std::vector<unsigned> TargetLowering::
More information about the llvm-commits
mailing list