diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-16 21:48:59 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-16 21:48:59 +0000 |
commit | 7d0c869b86d071aeb6a0c6447c0d03e08b50cab3 (patch) | |
tree | 3fe0c881ba241368bace4014f15c85bd71e689f3 | |
parent | df4b162e4dfab933873fed14f5dcc55574f85c1e (diff) | |
download | bcm5719-llvm-7d0c869b86d071aeb6a0c6447c0d03e08b50cab3.tar.gz bcm5719-llvm-7d0c869b86d071aeb6a0c6447c0d03e08b50cab3.zip |
X86: Simplify X86ISD::Wrapper operand checks. NFCI.
We only ever create TargetConstantPool, TargetJumpTable, TargetExternalSymbol,
TargetGlobalAddress, TargetGlobalTLSAddress, MCSymbol and TargetBlockAddress
nodes as operands of X86ISD::Wrapper nodes, so we can remove one check and
invert the other.
Also update the documentation comment for X86ISD::Wrapper.
Differential Revision: https://reviews.llvm.org/D26731
llvm-svn: 287160
-rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.h | 5 |
2 files changed, 8 insertions, 18 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 516d067d489..32f0c81978b 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -1564,12 +1564,9 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) { "Unexpected node type for MOV32ri64"); N = N.getOperand(0); - if (N->getOpcode() != ISD::TargetConstantPool && - N->getOpcode() != ISD::TargetJumpTable && - N->getOpcode() != ISD::TargetGlobalAddress && - N->getOpcode() != ISD::TargetExternalSymbol && - N->getOpcode() != ISD::MCSymbol && - N->getOpcode() != ISD::TargetBlockAddress) + // At least GNU as does not accept 'movl' for TPOFF relocations. + // FIXME: We could use 'movl' when we know we are targeting MC. + if (N->getOpcode() == ISD::TargetGlobalTLSAddress) return false; Imm = N; @@ -1715,16 +1712,8 @@ bool X86DAGToDAGISel::selectRelocImm(SDValue N, SDValue &Op) { if (N.getOpcode() != X86ISD::Wrapper) return false; - unsigned Opc = N.getOperand(0)->getOpcode(); - if (Opc == ISD::TargetConstantPool || Opc == ISD::TargetJumpTable || - Opc == ISD::TargetExternalSymbol || Opc == ISD::TargetGlobalAddress || - Opc == ISD::TargetGlobalTLSAddress || Opc == ISD::MCSymbol || - Opc == ISD::TargetBlockAddress) { - Op = N.getOperand(0); - return true; - } - - return false; + Op = N.getOperand(0); + return true; } bool X86DAGToDAGISel::tryFoldLoad(SDNode *P, SDValue N, diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index b5903e8ce39..c49cce1436f 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -139,8 +139,9 @@ namespace llvm { /// at function entry, used for PIC code. GlobalBaseReg, - /// A wrapper node for TargetConstantPool, - /// TargetExternalSymbol, and TargetGlobalAddress. + /// A wrapper node for TargetConstantPool, TargetJumpTable, + /// TargetExternalSymbol, TargetGlobalAddress, TargetGlobalTLSAddress, + /// MCSymbol and TargetBlockAddress. Wrapper, /// Special wrapper used under X86-64 PIC mode for RIP |