etcwilde updated this revision to Diff 540850. etcwilde added a comment. Fixing `push_back` formatting.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155413/new/ https://reviews.llvm.org/D155413 Files: clang/lib/CodeGen/CGStmt.cpp clang/lib/CodeGen/CodeGenFunction.cpp llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp llvm/examples/Kaleidoscope/Chapter5/toy.cpp llvm/examples/Kaleidoscope/Chapter6/toy.cpp llvm/examples/Kaleidoscope/Chapter7/toy.cpp llvm/examples/Kaleidoscope/Chapter8/toy.cpp llvm/examples/Kaleidoscope/Chapter9/toy.cpp llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp llvm/include/llvm/IR/Function.h
Index: llvm/include/llvm/IR/Function.h =================================================================== --- llvm/include/llvm/IR/Function.h +++ llvm/include/llvm/IR/Function.h @@ -693,6 +693,9 @@ return BasicBlocks.insert(Position, BB); } + /// append \p BB to the end of the function + void push_back(BasicBlock *BB) { return BasicBlocks.push_back(BB); } + /// Transfer all blocks from \p FromF to this function at \p ToIt. void splice(Function::iterator ToIt, Function *FromF) { splice(ToIt, FromF, FromF->begin(), FromF->end()); Index: llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp +++ llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp @@ -1025,7 +1025,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -1036,7 +1036,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp +++ llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp @@ -745,7 +745,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -756,7 +756,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp +++ llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp @@ -985,7 +985,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -996,7 +996,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp +++ llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp @@ -1205,7 +1205,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -1216,7 +1216,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp +++ llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp @@ -1127,7 +1127,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -1138,7 +1138,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp =================================================================== --- llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp +++ llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp @@ -763,7 +763,7 @@ ThenBB = Builder.GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder.SetInsertPoint(ElseBB); Value *ElseV = Else->Codegen(); @@ -774,7 +774,7 @@ ElseBB = Builder.GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder.SetInsertPoint(MergeBB); PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/Chapter9/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/Chapter9/toy.cpp +++ llvm/examples/Kaleidoscope/Chapter9/toy.cpp @@ -1037,7 +1037,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -1049,7 +1049,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/Chapter8/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/Chapter8/toy.cpp +++ llvm/examples/Kaleidoscope/Chapter8/toy.cpp @@ -867,7 +867,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -879,7 +879,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/Chapter7/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/Chapter7/toy.cpp +++ llvm/examples/Kaleidoscope/Chapter7/toy.cpp @@ -869,7 +869,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -881,7 +881,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/Chapter6/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/Chapter6/toy.cpp +++ llvm/examples/Kaleidoscope/Chapter6/toy.cpp @@ -762,7 +762,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -774,7 +774,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/Chapter5/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ llvm/examples/Kaleidoscope/Chapter5/toy.cpp @@ -650,7 +650,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -662,7 +662,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp +++ llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp @@ -846,7 +846,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -858,7 +858,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp +++ llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp @@ -863,7 +863,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp +++ llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp @@ -863,7 +863,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp =================================================================== --- llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp +++ llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp @@ -863,7 +863,7 @@ ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst =================================================================== --- llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst +++ llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst @@ -377,7 +377,7 @@ .. code-block:: c++ // Emit else block. - TheFunction->insert(TheFunction->end(), ElseBB); + TheFunction->push_back(ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -398,7 +398,7 @@ .. code-block:: c++ // Emit merge block. - TheFunction->insert(TheFunction->end(), MergeBB); + TheFunction->push_back(MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); Index: clang/lib/CodeGen/CodeGenFunction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenFunction.cpp +++ clang/lib/CodeGen/CodeGenFunction.cpp @@ -322,7 +322,7 @@ static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) { if (!BB) return; if (!BB->use_empty()) { - CGF.CurFn->insert(CGF.CurFn->end(), BB); + CGF.CurFn->push_back(BB); return; } delete BB; Index: clang/lib/CodeGen/CGStmt.cpp =================================================================== --- clang/lib/CodeGen/CGStmt.cpp +++ clang/lib/CodeGen/CGStmt.cpp @@ -582,7 +582,7 @@ if (CurBB && CurBB->getParent()) CurFn->insert(std::next(CurBB->getIterator()), BB); else - CurFn->insert(CurFn->end(), BB); + CurFn->push_back(BB); Builder.SetInsertPoint(BB); } @@ -614,7 +614,7 @@ } if (!inserted) - CurFn->insert(CurFn->end(), block); + CurFn->push_back(block); Builder.SetInsertPoint(block); } @@ -1474,7 +1474,7 @@ llvm::BasicBlock *FalseDest = CaseRangeBlock; CaseRangeBlock = createBasicBlock("sw.caserange"); - CurFn->insert(CurFn->end(), CaseRangeBlock); + CurFn->push_back(CaseRangeBlock); Builder.SetInsertPoint(CaseRangeBlock); // Emit range check.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits