From b82de79bc1ba6d54712d5c6c4ce13df8598bb37c Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Wed, 6 May 2015 23:53:19 +0000 Subject: [PATCH] [Statepoints] Clean up PlaceSafepoints.cpp: variable naming. Use CamelCase. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236673 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/PlaceSafepoints.cpp | 60 +++++++++++------------ 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/lib/Transforms/Scalar/PlaceSafepoints.cpp b/lib/Transforms/Scalar/PlaceSafepoints.cpp index 36a1fea4edc..b68a09fea14 100644 --- a/lib/Transforms/Scalar/PlaceSafepoints.cpp +++ b/lib/Transforms/Scalar/PlaceSafepoints.cpp @@ -882,36 +882,35 @@ static Value *ReplaceWithStatepoint(const CallSite &CS, /* to replace */ // immediately before the previous instruction under the assumption that all // arguments will be available here. We can't insert afterwards since we may // be replacing a terminator. - Instruction *insertBefore = CS.getInstruction(); - IRBuilder<> Builder(insertBefore); + IRBuilder<> Builder(CS.getInstruction()); // Note: The gc args are not filled in at this time, that's handled by // RewriteStatepointsForGC (which is currently under review). // Create the statepoint given all the arguments - Instruction *token = nullptr; - AttributeSet return_attributes; + Instruction *Token = nullptr; + AttributeSet ReturnAttrs; if (CS.isCall()) { - CallInst *toReplace = cast(CS.getInstruction()); + CallInst *ToReplace = cast(CS.getInstruction()); CallInst *Call = Builder.CreateGCStatepointCall( CS.getCalledValue(), makeArrayRef(CS.arg_begin(), CS.arg_end()), None, None, "safepoint_token"); - Call->setTailCall(toReplace->isTailCall()); - Call->setCallingConv(toReplace->getCallingConv()); + Call->setTailCall(ToReplace->isTailCall()); + Call->setCallingConv(ToReplace->getCallingConv()); // Before we have to worry about GC semantics, all attributes are legal - AttributeSet new_attrs = toReplace->getAttributes(); + AttributeSet OriginalAttrs = ToReplace->getAttributes(); // In case if we can handle this set of sttributes - set up function attrs // directly on statepoint and return attrs later for gc_result intrinsic. - Call->setAttributes(new_attrs.getFnAttributes()); - return_attributes = new_attrs.getRetAttributes(); + Call->setAttributes(OriginalAttrs.getFnAttributes()); + ReturnAttrs = OriginalAttrs.getRetAttributes(); // TODO: handle param attributes - token = Call; + Token = Call; // Put the following gc_result and gc_relocate calls immediately after the // the old call (which we're about to delete) - BasicBlock::iterator next(toReplace); + BasicBlock::iterator next(ToReplace); assert(BB->end() != next && "not a terminator, must have next"); next++; Instruction *IP = &*(next); @@ -919,48 +918,47 @@ static Value *ReplaceWithStatepoint(const CallSite &CS, /* to replace */ Builder.SetCurrentDebugLocation(IP->getDebugLoc()); } else if (CS.isInvoke()) { - InvokeInst *toReplace = cast(CS.getInstruction()); + InvokeInst *ToReplace = cast(CS.getInstruction()); // Insert the new invoke into the old block. We'll remove the old one in a // moment at which point this will become the new terminator for the // original block. - Builder.SetInsertPoint(toReplace->getParent()); - InvokeInst *invoke = Builder.CreateGCStatepointInvoke( - CS.getCalledValue(), toReplace->getNormalDest(), - toReplace->getUnwindDest(), makeArrayRef(CS.arg_begin(), CS.arg_end()), + Builder.SetInsertPoint(ToReplace->getParent()); + InvokeInst *Invoke = Builder.CreateGCStatepointInvoke( + CS.getCalledValue(), ToReplace->getNormalDest(), + ToReplace->getUnwindDest(), makeArrayRef(CS.arg_begin(), CS.arg_end()), Builder.getInt32(0), None, "safepoint_token"); // Currently we will fail on parameter attributes and on certain // function attributes. - AttributeSet new_attrs = toReplace->getAttributes(); + AttributeSet OriginalAttrs = ToReplace->getAttributes(); // In case if we can handle this set of sttributes - set up function attrs // directly on statepoint and return attrs later for gc_result intrinsic. - invoke->setAttributes(new_attrs.getFnAttributes()); - return_attributes = new_attrs.getRetAttributes(); + Invoke->setAttributes(OriginalAttrs.getFnAttributes()); + ReturnAttrs = OriginalAttrs.getRetAttributes(); - token = invoke; + Token = Invoke; // We'll insert the gc.result into the normal block - BasicBlock *normalDest = normalizeBBForInvokeSafepoint( - toReplace->getNormalDest(), invoke->getParent()); - Instruction *IP = &*(normalDest->getFirstInsertionPt()); + BasicBlock *NormalDest = normalizeBBForInvokeSafepoint( + ToReplace->getNormalDest(), Invoke->getParent()); + Instruction *IP = &*(NormalDest->getFirstInsertionPt()); Builder.SetInsertPoint(IP); } else { llvm_unreachable("unexpect type of CallSite"); } - assert(token); + assert(Token); // Handle the return value of the original call - update all uses to use a // gc_result hanging off the statepoint node we just inserted // Only add the gc_result iff there is actually a used result if (!CS.getType()->isVoidTy() && !CS.getInstruction()->use_empty()) { - std::string takenName = - CS.getInstruction()->hasName() ? CS.getInstruction()->getName() : ""; - CallInst *gc_result = - Builder.CreateGCResult(token, CS.getType(), takenName); - gc_result->setAttributes(return_attributes); - return gc_result; + std::string TakenName = + CS.getInstruction()->hasName() ? CS.getInstruction()->getName() : ""; + CallInst *GCResult = Builder.CreateGCResult(Token, CS.getType(), TakenName); + GCResult->setAttributes(ReturnAttrs); + return GCResult; } else { // No return value for the call. return nullptr;