[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td
Evan Cheng
evan.cheng at apple.com
Wed Dec 21 15:05:52 PST 2005
Changes in directory llvm/lib/Target/X86:
X86ISelDAGToDAG.cpp updated: 1.18 -> 1.19
X86ISelLowering.cpp updated: 1.14 -> 1.15
X86ISelLowering.h updated: 1.7 -> 1.8
X86InstrInfo.td updated: 1.181 -> 1.182
---
Log message:
* Fix a GlobalAddress lowering bug.
* Teach DAG combiner about X86ISD::SETCC by adding a TargetLowering hook.
---
Diffs of the changes: (+29 -5)
X86ISelDAGToDAG.cpp | 1 +
X86ISelLowering.cpp | 23 ++++++++++++++++++++---
X86ISelLowering.h | 6 ++++++
X86InstrInfo.td | 4 ++--
4 files changed, 29 insertions(+), 5 deletions(-)
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.18 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.19
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.18 Tue Dec 20 20:41:57 2005
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Dec 21 17:05:39 2005
@@ -172,6 +172,7 @@
break;
case ISD::GlobalAddress:
+ case ISD::TargetGlobalAddress:
if (AM.GV == 0) {
AM.GV = cast<GlobalAddressSDNode>(N)->getGlobal();
return false;
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.14 llvm/lib/Target/X86/X86ISelLowering.cpp:1.15
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.14 Wed Dec 21 14:51:37 2005
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Dec 21 17:05:39 2005
@@ -122,6 +122,7 @@
setOperationAction(ISD::SETCC , MVT::i8 , Custom);
setOperationAction(ISD::SETCC , MVT::i16 , Custom);
setOperationAction(ISD::SETCC , MVT::i32 , Custom);
+ setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom);
}
// We don't have line number support yet.
@@ -1051,6 +1052,7 @@
}
case ISD::GlobalAddress:
GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
+ SDOperand GVOp = DAG.getTargetGlobalAddress(GV, getPointerTy());
// For Darwin, external and weak symbols are indirect, so we want to load
// the value at address GV, not the value of GV itself. This means that
// the GlobalAddress must be in the base or index register of the address,
@@ -1058,10 +1060,10 @@
if (getTargetMachine().
getSubtarget<X86Subtarget>().getIndirectExternAndWeakGlobals() &&
(GV->hasWeakLinkage() || GV->isExternal()))
- return DAG.getLoad(MVT::i32, DAG.getEntryNode(), Op,
- DAG.getSrcValue(NULL));
+ return DAG.getLoad(MVT::i32, DAG.getEntryNode(),
+ GVOp, DAG.getSrcValue(NULL));
else
- return Op;
+ return GVOp;
break;
}
}
@@ -1086,3 +1088,18 @@
case X86ISD::RET_FLAG: return "X86ISD::RET_FLAG";
}
}
+
+bool X86TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op,
+ uint64_t Mask) const {
+
+ unsigned Opc = Op.getOpcode();
+
+ switch (Opc) {
+ default:
+ assert(Opc >= ISD::BUILTIN_OP_END && "Expected a target specific node");
+ break;
+ case X86ISD::SETCC: return (Mask & 1) == 0;
+ }
+
+ return false;
+}
Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.7 llvm/lib/Target/X86/X86ISelLowering.h:1.8
--- llvm/lib/Target/X86/X86ISelLowering.h:1.7 Wed Dec 21 14:21:51 2005
+++ llvm/lib/Target/X86/X86ISelLowering.h Wed Dec 21 17:05:39 2005
@@ -155,6 +155,12 @@
/// DAG node.
virtual const char *getTargetNodeName(unsigned Opcode) const;
+ /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to
+ /// be zero. Op is expected to be a target specific node. Used by DAG
+ /// combiner.
+ virtual bool isMaskedValueZeroForTargetNode(const SDOperand &Op,
+ uint64_t Mask) const;
+
SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
private:
Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.181 llvm/lib/Target/X86/X86InstrInfo.td:1.182
--- llvm/lib/Target/X86/X86InstrInfo.td:1.181 Wed Dec 21 16:22:16 2005
+++ llvm/lib/Target/X86/X86InstrInfo.td Wed Dec 21 17:05:39 2005
@@ -98,8 +98,8 @@
// Define X86 specific addressing mode.
def addr : ComplexPattern<i32, 4, "SelectAddr", []>;
def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr",
- [add,
- frameindex, constpool, globaladdr, externalsym]>;
+ [add, frameindex, constpool,
+ globaladdr, tglobaladdr, externalsym]>;
//===----------------------------------------------------------------------===//
// X86 Instruction Format Definitions.
More information about the llvm-commits
mailing list