//===------ PollyIRBuilder.cpp --------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // The Polly IRBuilder file contains Polly specific extensions for the IRBuilder // that are used e.g. to emit the llvm.loop.parallel metadata. // //===----------------------------------------------------------------------===// #include "polly/CodeGen/IRBuilder.h" #include "polly/ScopInfo.h" #include "polly/Support/ScopHelper.h" #include "llvm/ADT/SmallVector.h" #include "llvm/IR/Metadata.h" usingnamespacellvm; usingnamespacepolly; static const int MaxArraysInAliasScops = …; /// Get a self referencing id metadata node. /// /// The MDNode looks like this (if arg0/arg1 are not null): /// /// '!n = distinct !{!n, arg0, arg1}' /// /// @return The self referencing id metadata node. static MDNode *getID(LLVMContext &Ctx, Metadata *arg0 = nullptr, Metadata *arg1 = nullptr) { … } ScopAnnotator::ScopAnnotator() : … { … } ScopAnnotator::~ScopAnnotator() { … } void ScopAnnotator::buildAliasScopes(Scop &S) { … } void ScopAnnotator::pushLoop(Loop *L, bool IsParallel) { … } void ScopAnnotator::popLoop(bool IsParallel) { … } void ScopAnnotator::annotateLoopLatch(BranchInst *B, Loop *L, bool IsParallel, bool IsLoopVectorizerDisabled) const { … } /// Get the pointer operand /// /// @param Inst The instruction to be analyzed. /// @return the pointer operand in case @p Inst is a memory access /// instruction and nullptr otherwise. static llvm::Value *getMemAccInstPointerOperand(Instruction *Inst) { … } /// Find the base pointer of an array access. /// /// This should be equivalent to ScalarEvolution::getPointerBase, which we /// cannot use here the IR is still under construction which ScalarEvolution /// assumes to not be modified. static Value *findBasePtr(Value *Val) { … } void ScopAnnotator::annotate(Instruction *Inst) { … }