33 assert(
G.hasSanitizerMetadata() &&
34 "Missing sanitizer metadata, but symbol is apparently tagged.");
40 if (
G.getName().starts_with(
"llvm.") ||
G.isThreadLocal() ||
G.isConstant()) {
42 G.setSanitizerMetadata(Meta);
66 G.setSanitizerMetadata(Meta);
93 Constant *Initializer =
G->getInitializer();
95 M.getDataLayout().getTypeAllocSize(Initializer->
getType());
98 if (SizeInBytes != NewSize) {
104 M, Initializer->
getType(),
G->isConstant(),
G->getLinkage(),
105 Initializer,
"",
G,
G->getThreadLocalMode(),
G->getAddressSpace());
106 NewGV->copyAttributesFrom(
G);
107 NewGV->setComdat(
G->getComdat());
108 NewGV->copyMetadata(
G, 0);
111 G->replaceAllUsesWith(NewGV);
112 G->eraseFromParent();
120 G->setUnnamedAddr(GlobalValue::UnnamedAddr::None);
124class AArch64GlobalsTagging :
public ModulePass {
137 std::set<GlobalVariable *> GlobalsToTag;
141char AArch64GlobalsTagging::ID = 0;
143bool AArch64GlobalsTagging::runOnModule(
Module &M) {
145 std::vector<GlobalVariable *> GlobalsToTag;
149 GlobalsToTag.push_back(&
G);
160 "AArch64 Globals Tagging Pass",
false,
false)
165 return new AArch64GlobalsTagging();
static bool shouldTagGlobal(GlobalVariable &G)
static void tagGlobalDefinition(Module &M, GlobalVariable *G)
static const Align kTagGranuleSize
This file contains the simple types necessary to represent the attributes associated with functions a...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
This is an important base class in LLVM.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Pass interface - Implemented by all 'passes'.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Type * getType() const
All values are typed, get the type of this value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void initializeAArch64GlobalsTaggingPass(PassRegistry &)
ModulePass * createAArch64GlobalsTaggingPass()
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This struct is a compact representation of a valid (non-zero power of two) alignment.