//===-- Instrumentation.cpp - TransformUtils Infrastructure ---------------===// // // 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 defines the common initialization infrastructure for the // Instrumentation library. // //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/Instrumentation.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" #include "llvm/TargetParser/Triple.h" usingnamespacellvm; static cl::opt<bool> ClIgnoreRedundantInstrumentation( "ignore-redundant-instrumentation", cl::desc("Ignore redundant instrumentation"), cl::Hidden, cl::init(false)); /// Check if module has flag attached, if not add the flag. bool llvm::checkIfAlreadyInstrumented(Module &M, StringRef Flag) { … } /// Moves I before IP. Returns new insert point. static BasicBlock::iterator moveBeforeInsertPoint(BasicBlock::iterator I, BasicBlock::iterator IP) { … } /// Instrumentation passes often insert conditional checks into entry blocks. /// Call this function before splitting the entry block to move instructions /// that must remain in the entry block up before the split point. Static /// allocas and llvm.localescape calls, for example, must remain in the entry /// block. BasicBlock::iterator llvm::PrepareToSplitEntryBlock(BasicBlock &BB, BasicBlock::iterator IP) { … } // Create a constant for Str so that we can pass it to the run-time lib. GlobalVariable *llvm::createPrivateGlobalForString(Module &M, StringRef Str, bool AllowMerging, Twine NamePrefix) { … } Comdat *llvm::getOrCreateFunctionComdat(Function &F, Triple &T) { … } void llvm::setGlobalVariableLargeSection(const Triple &TargetTriple, GlobalVariable &GV) { … }