diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-07 00:43:41 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-07 00:43:41 +0000 |
commit | 4e3e3deed3280f7ca2a87d5ae0ed922dd2b7f6a5 (patch) | |
tree | 9c17f1f76258c35db2e70784b3cd6c8610b8fcf5 | |
parent | 78fe44ed529bb70a27dfbc6ddd842421e54bc3e7 (diff) | |
download | bcm5719-llvm-4e3e3deed3280f7ca2a87d5ae0ed922dd2b7f6a5.tar.gz bcm5719-llvm-4e3e3deed3280f7ca2a87d5ae0ed922dd2b7f6a5.zip |
Refactor some repeated logic into a separate function.
llvm-svn: 63989
-rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 8c5aac397a6..ed6c3569636 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -76,6 +76,11 @@ namespace { : BaseType(RegBase), isRIPRel(false), Scale(1), IndexReg(), Disp(0), GV(0), CP(0), ES(0), JT(-1), Align(0) { } + + bool hasSymbolicDisplacement() const { + return GV != 0 || CP != 0 || ES != 0 || JT != -1; + } + void dump() { cerr << "X86ISelAddressMode " << this << "\n"; cerr << "Base.Reg "; @@ -768,7 +773,7 @@ bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM, if (is64Bit && (TM.getCodeModel() != CodeModel::Small || AM.Base.Reg.getNode() || AM.IndexReg.getNode())) break; - if (AM.GV != 0 || AM.CP != 0 || AM.ES != 0 || AM.JT != -1) + if (AM.hasSymbolicDisplacement()) break; // If value is available in a register both base and index components have // been picked, we can't fit the result available in the register in the @@ -1114,7 +1119,7 @@ bool X86DAGToDAGISel::SelectLEAAddr(SDValue Op, SDValue N, // optimal (especially for code size consideration). LEA is nice because of // its three-address nature. Tweak the cost function again when we can run // convertToThreeAddress() at register allocation time. - if (AM.GV || AM.CP || AM.ES || AM.JT != -1) { + if (AM.hasSymbolicDisplacement()) { // For X86-64, we should always use lea to materialize RIP relative // addresses. if (Subtarget->is64Bit()) |