#include "llvm/Transforms/Utils/ModuleUtils.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/xxhash.h"
usingnamespacellvm;
#define DEBUG_TYPE …
static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F,
int Priority, Constant *Data) { … }
void llvm::appendToGlobalCtors(Module &M, Function *F, int Priority, Constant *Data) { … }
void llvm::appendToGlobalDtors(Module &M, Function *F, int Priority, Constant *Data) { … }
static void transformGlobalArray(StringRef ArrayName, Module &M,
const GlobalCtorTransformFn &Fn) { … }
void llvm::transformGlobalCtors(Module &M, const GlobalCtorTransformFn &Fn) { … }
void llvm::transformGlobalDtors(Module &M, const GlobalCtorTransformFn &Fn) { … }
static void collectUsedGlobals(GlobalVariable *GV,
SmallSetVector<Constant *, 16> &Init) { … }
static void appendToUsedList(Module &M, StringRef Name, ArrayRef<GlobalValue *> Values) { … }
void llvm::appendToUsed(Module &M, ArrayRef<GlobalValue *> Values) { … }
void llvm::appendToCompilerUsed(Module &M, ArrayRef<GlobalValue *> Values) { … }
static void removeFromUsedList(Module &M, StringRef Name,
function_ref<bool(Constant *)> ShouldRemove) { … }
void llvm::removeFromUsedLists(Module &M,
function_ref<bool(Constant *)> ShouldRemove) { … }
void llvm::setKCFIType(Module &M, Function &F, StringRef MangledType) { … }
FunctionCallee llvm::declareSanitizerInitFunction(Module &M, StringRef InitName,
ArrayRef<Type *> InitArgTypes,
bool Weak) { … }
Function *llvm::createSanitizerCtor(Module &M, StringRef CtorName) { … }
std::pair<Function *, FunctionCallee> llvm::createSanitizerCtorAndInitFunctions(
Module &M, StringRef CtorName, StringRef InitName,
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
StringRef VersionCheckName, bool Weak) { … }
std::pair<Function *, FunctionCallee>
llvm::getOrCreateSanitizerCtorAndInitFunctions(
Module &M, StringRef CtorName, StringRef InitName,
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
function_ref<void(Function *, FunctionCallee)> FunctionsCreatedCallback,
StringRef VersionCheckName, bool Weak) { … }
void llvm::filterDeadComdatFunctions(
SmallVectorImpl<Function *> &DeadComdatFunctions) { … }
std::string llvm::getUniqueModuleId(Module *M) { … }
void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
StringRef SectionName, Align Alignment) { … }
bool llvm::lowerGlobalIFuncUsersAsGlobalCtor(
Module &M, ArrayRef<GlobalIFunc *> FilteredIFuncsToLower) { … }