From bdc4956bac81a93d541bc2fab0fdcc7ffdeb5cdd Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 12 Jun 2016 15:39:02 +0000 Subject: Pass DebugLoc and SDLoc by const ref. This used to be free, copying and moving DebugLocs became expensive after the metadata rewrite. Passing by reference eliminates a ton of track/untrack operations. No functionality change intended. llvm-svn: 272512 --- .../lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp | 83 ++++++++++------------ 1 file changed, 38 insertions(+), 45 deletions(-) (limited to 'llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp') diff --git a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp index 178aa381731..0363c665946 100644 --- a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp @@ -23,7 +23,7 @@ using namespace llvm; // address Dest. Sequence is the opcode to use for straight-line code // (such as MVC) and Loop is the opcode to use for loops (such as MVC_LOOP). // Return the chain for the completed operation. -static SDValue emitMemMem(SelectionDAG &DAG, SDLoc DL, unsigned Sequence, +static SDValue emitMemMem(SelectionDAG &DAG, const SDLoc &DL, unsigned Sequence, unsigned Loop, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size) { EVT PtrVT = Src.getValueType(); @@ -46,12 +46,10 @@ static SDValue emitMemMem(SelectionDAG &DAG, SDLoc DL, unsigned Sequence, DAG.getConstant(Size, DL, PtrVT)); } -SDValue SystemZSelectionDAGInfo:: -EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Dst, SDValue Src, SDValue Size, unsigned Align, - bool IsVolatile, bool AlwaysInline, - MachinePointerInfo DstPtrInfo, - MachinePointerInfo SrcPtrInfo) const { +SDValue SystemZSelectionDAGInfo::EmitTargetCodeForMemcpy( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src, + SDValue Size, unsigned Align, bool IsVolatile, bool AlwaysInline, + MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const { if (IsVolatile) return SDValue(); @@ -64,10 +62,9 @@ EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, // Handle a memset of 1, 2, 4 or 8 bytes with the operands given by // Chain, Dst, ByteVal and Size. These cases are expected to use // MVI, MVHHI, MVHI and MVGHI respectively. -static SDValue memsetStore(SelectionDAG &DAG, SDLoc DL, SDValue Chain, +static SDValue memsetStore(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, uint64_t ByteVal, uint64_t Size, - unsigned Align, - MachinePointerInfo DstPtrInfo) { + unsigned Align, MachinePointerInfo DstPtrInfo) { uint64_t StoreVal = ByteVal; for (unsigned I = 1; I < Size; ++I) StoreVal |= ByteVal << (I * 8); @@ -77,11 +74,10 @@ static SDValue memsetStore(SelectionDAG &DAG, SDLoc DL, SDValue Chain, Dst, DstPtrInfo, false, false, Align); } -SDValue SystemZSelectionDAGInfo:: -EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Dst, SDValue Byte, SDValue Size, - unsigned Align, bool IsVolatile, - MachinePointerInfo DstPtrInfo) const { +SDValue SystemZSelectionDAGInfo::EmitTargetCodeForMemset( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, + SDValue Byte, SDValue Size, unsigned Align, bool IsVolatile, + MachinePointerInfo DstPtrInfo) const { EVT PtrVT = Dst.getValueType(); if (IsVolatile) @@ -150,7 +146,7 @@ EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc DL, SDValue Chain, // Use CLC to compare [Src1, Src1 + Size) with [Src2, Src2 + Size), // deciding whether to use a loop or straight-line code. -static SDValue emitCLC(SelectionDAG &DAG, SDLoc DL, SDValue Chain, +static SDValue emitCLC(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, SDValue Src2, uint64_t Size) { SDVTList VTs = DAG.getVTList(MVT::Other, MVT::Glue); EVT PtrVT = Src1.getValueType(); @@ -174,7 +170,8 @@ static SDValue emitCLC(SelectionDAG &DAG, SDLoc DL, SDValue Chain, // less than zero if CC == 1 and greater than zero if CC >= 2. // The sequence starts with IPM, which puts CC into bits 29 and 28 // of an integer and clears bits 30 and 31. -static SDValue addIPMSequence(SDLoc DL, SDValue Glue, SelectionDAG &DAG) { +static SDValue addIPMSequence(const SDLoc &DL, SDValue Glue, + SelectionDAG &DAG) { SDValue IPM = DAG.getNode(SystemZISD::IPM, DL, MVT::i32, Glue); SDValue SRL = DAG.getNode(ISD::SRL, DL, MVT::i32, IPM, DAG.getConstant(SystemZ::IPM_CC, DL, MVT::i32)); @@ -183,11 +180,10 @@ static SDValue addIPMSequence(SDLoc DL, SDValue Glue, SelectionDAG &DAG) { return ROTL; } -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Src1, SDValue Src2, SDValue Size, - MachinePointerInfo Op1PtrInfo, - MachinePointerInfo Op2PtrInfo) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForMemcmp( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, + SDValue Src2, SDValue Size, MachinePointerInfo Op1PtrInfo, + MachinePointerInfo Op2PtrInfo) const { if (auto *CSize = dyn_cast(Size)) { uint64_t Bytes = CSize->getZExtValue(); assert(Bytes > 0 && "Caller should have handled 0-size case"); @@ -198,10 +194,9 @@ EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc DL, SDValue Chain, return std::make_pair(SDValue(), SDValue()); } -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Src, SDValue Char, SDValue Length, - MachinePointerInfo SrcPtrInfo) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForMemchr( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, + SDValue Char, SDValue Length, MachinePointerInfo SrcPtrInfo) const { // Use SRST to find the character. End is its address on success. EVT PtrVT = Src.getValueType(); SDVTList VTs = DAG.getVTList(PtrVT, MVT::Other, MVT::Glue); @@ -226,22 +221,20 @@ EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc DL, SDValue Chain, return std::make_pair(End, Chain); } -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Dest, SDValue Src, - MachinePointerInfo DestPtrInfo, - MachinePointerInfo SrcPtrInfo, bool isStpcpy) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForStrcpy( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dest, + SDValue Src, MachinePointerInfo DestPtrInfo, MachinePointerInfo SrcPtrInfo, + bool isStpcpy) const { SDVTList VTs = DAG.getVTList(Dest.getValueType(), MVT::Other); SDValue EndDest = DAG.getNode(SystemZISD::STPCPY, DL, VTs, Chain, Dest, Src, DAG.getConstant(0, DL, MVT::i32)); return std::make_pair(isStpcpy ? EndDest : Dest, EndDest.getValue(1)); } -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Src1, SDValue Src2, - MachinePointerInfo Op1PtrInfo, - MachinePointerInfo Op2PtrInfo) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForStrcmp( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, + SDValue Src2, MachinePointerInfo Op1PtrInfo, + MachinePointerInfo Op2PtrInfo) const { SDVTList VTs = DAG.getVTList(Src1.getValueType(), MVT::Other, MVT::Glue); SDValue Unused = DAG.getNode(SystemZISD::STRCMP, DL, VTs, Chain, Src1, Src2, DAG.getConstant(0, DL, MVT::i32)); @@ -255,7 +248,8 @@ EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc DL, SDValue Chain, // and the second being the out chain. // // This can be used for strlen by setting Limit to 0. -static std::pair getBoundedStrlen(SelectionDAG &DAG, SDLoc DL, +static std::pair getBoundedStrlen(SelectionDAG &DAG, + const SDLoc &DL, SDValue Chain, SDValue Src, SDValue Limit) { EVT PtrVT = Src.getValueType(); @@ -265,19 +259,18 @@ static std::pair getBoundedStrlen(SelectionDAG &DAG, SDLoc DL, Chain = End.getValue(1); SDValue Len = DAG.getNode(ISD::SUB, DL, PtrVT, End, Src); return std::make_pair(Len, Chain); -} +} -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Src, MachinePointerInfo SrcPtrInfo) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForStrlen( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, + MachinePointerInfo SrcPtrInfo) const { EVT PtrVT = Src.getValueType(); return getBoundedStrlen(DAG, DL, Chain, Src, DAG.getConstant(0, DL, PtrVT)); } -std::pair SystemZSelectionDAGInfo:: -EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, - SDValue Src, SDValue MaxLength, - MachinePointerInfo SrcPtrInfo) const { +std::pair SystemZSelectionDAGInfo::EmitTargetCodeForStrnlen( + SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, + SDValue MaxLength, MachinePointerInfo SrcPtrInfo) const { EVT PtrVT = Src.getValueType(); MaxLength = DAG.getZExtOrTrunc(MaxLength, DL, PtrVT); SDValue Limit = DAG.getNode(ISD::ADD, DL, PtrVT, Src, MaxLength); -- cgit v1.2.3