//===------ LoopGeneratorsGOMP.cpp - IR helper to create loops ------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains functions to create parallel loops as LLVM-IR. // //===----------------------------------------------------------------------===// #include "polly/CodeGen/LoopGeneratorsGOMP.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Module.h" usingnamespacellvm; usingnamespacepolly; void ParallelLoopGeneratorGOMP::createCallSpawnThreads(Value *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) { … } void ParallelLoopGeneratorGOMP::deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) { … } Function *ParallelLoopGeneratorGOMP::prepareSubFnDefinition(Function *F) const { … } // Create a subfunction of the following (preliminary) structure: // // PrevBB // | // v // HeaderBB // | _____ // v v | // CheckNextBB PreHeaderBB // |\ | // | \______/ // | // v // ExitBB // // HeaderBB will hold allocations and loading of variables. // CheckNextBB will check for more work. // If there is more work to do: go to PreHeaderBB, otherwise go to ExitBB. // PreHeaderBB loads the new boundaries (& will lead to the loop body later on). // ExitBB marks the end of the parallel execution. std::tuple<Value *, Function *> ParallelLoopGeneratorGOMP::createSubFn(Value *Stride, AllocaInst *StructData, SetVector<Value *> Data, ValueMapT &Map) { … } Value *ParallelLoopGeneratorGOMP::createCallGetWorkItem(Value *LBPtr, Value *UBPtr) { … } void ParallelLoopGeneratorGOMP::createCallJoinThreads() { … } void ParallelLoopGeneratorGOMP::createCallCleanupThread() { … }