From 341c07ba830a21c0e6f3e4b5493ee3aee60a432b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 29 Nov 2016 15:32:58 +0000 Subject: [PATCH] [X86] Moved getTargetConstantFromNode function so a future patch is more understandable. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288147 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index c902cb2a36d..32c6696e85c 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -5018,6 +5018,25 @@ static SDValue peekThroughOneUseBitcasts(SDValue V) { return V; } +static const Constant *getTargetConstantFromNode(SDValue Op) { + Op = peekThroughBitcasts(Op); + + auto *Load = dyn_cast(Op); + if (!Load) + return nullptr; + + SDValue Ptr = Load->getBasePtr(); + if (Ptr->getOpcode() == X86ISD::Wrapper || + Ptr->getOpcode() == X86ISD::WrapperRIP) + Ptr = Ptr->getOperand(0); + + auto *CNode = dyn_cast(Ptr); + if (!CNode || CNode->isMachineConstantPoolEntry()) + return nullptr; + + return dyn_cast(CNode->getConstVal()); +} + static bool getTargetShuffleMaskIndices(SDValue MaskNode, unsigned MaskEltSizeInBits, SmallVectorImpl &RawMask) { @@ -5101,25 +5120,6 @@ static bool getTargetShuffleMaskIndices(SDValue MaskNode, return true; } -static const Constant *getTargetConstantFromNode(SDValue Op) { - Op = peekThroughBitcasts(Op); - - auto *Load = dyn_cast(Op); - if (!Load) - return nullptr; - - SDValue Ptr = Load->getBasePtr(); - if (Ptr->getOpcode() == X86ISD::Wrapper || - Ptr->getOpcode() == X86ISD::WrapperRIP) - Ptr = Ptr->getOperand(0); - - auto *CNode = dyn_cast(Ptr); - if (!CNode || CNode->isMachineConstantPoolEntry()) - return nullptr; - - return dyn_cast(CNode->getConstVal()); -} - /// Calculates the shuffle mask corresponding to the target-specific opcode. /// If the mask could be calculated, returns it in \p Mask, returns the shuffle /// operands in \p Ops, and returns true. -- 2.50.1