Clean up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32027 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-11-29 23:46:27 +00:00
parent d0ff02cf6f
commit 4946399b64

View File

@ -643,10 +643,12 @@ bool X86DAGToDAGISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM,
// For X86-64 PIC code, only allow GV / CP + displacement so we can use RIP // For X86-64 PIC code, only allow GV / CP + displacement so we can use RIP
// relative addressing mode. // relative addressing mode.
if ((!Subtarget->is64Bit() || TM.getCodeModel() == CodeModel::Small) && if (Subtarget->is64Bit() && TM.getCodeModel() != CodeModel::Small)
(!Available || (AM.Base.Reg.Val && AM.IndexReg.Val))) { break;
if (!Available || (AM.Base.Reg.Val && AM.IndexReg.Val)) {
bool isRIP = Subtarget->is64Bit(); bool isRIP = Subtarget->is64Bit();
if (isRIP && (AM.Base.Reg.Val || AM.Scale > 1 || AM.IndexReg.Val || if (isRIP &&
(AM.Base.Reg.Val || AM.Scale > 1 || AM.IndexReg.Val ||
AM.BaseType == X86ISelAddressMode::FrameIndexBase)) AM.BaseType == X86ISelAddressMode::FrameIndexBase))
break; break;
if (ConstantPoolSDNode *CP = if (ConstantPoolSDNode *CP =
@ -655,8 +657,7 @@ bool X86DAGToDAGISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM,
AM.CP = CP->getConstVal(); AM.CP = CP->getConstVal();
AM.Align = CP->getAlignment(); AM.Align = CP->getAlignment();
AM.Disp += CP->getOffset(); AM.Disp += CP->getOffset();
if (isRIP) AM.isRIPRel = isRIP;
AM.isRIPRel = true;
return false; return false;
} }
} else if (GlobalAddressSDNode *G = } else if (GlobalAddressSDNode *G =
@ -664,8 +665,7 @@ bool X86DAGToDAGISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM,
if (AM.GV == 0) { if (AM.GV == 0) {
AM.GV = G->getGlobal(); AM.GV = G->getGlobal();
AM.Disp += G->getOffset(); AM.Disp += G->getOffset();
if (isRIP) AM.isRIPRel = isRIP;
AM.isRIPRel = true;
return false; return false;
} }
} else if (isRoot && isRIP) { } else if (isRoot && isRIP) {