27 explicit SystemZAlignGlobals() : ModulePass(ID) {}
29 StringRef getPassName()
const override {
return "SystemZ Align Globals"; }
31 bool runOnModule(
Module &M)
override;
36char SystemZAlignGlobals::ID = 0;
39 "Try aligning globals to 2 bytes",
false,
false)
42 return new SystemZAlignGlobals();
45bool SystemZAlignGlobals::runOnModule(
Module &M) {
48 for (GlobalVariable &GV :
M.globals()) {
49 MaybeAlign GVAlign = GV.getAlign();
50 if (!GVAlign || GVAlign.value() > 1)
53 if (!GV.canIncreaseAlignment())
56 GV.setAlignment(
Align(2));
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This is an optimization pass for GlobalISel generic memory operations.
ModulePass * createSystemZAlignGlobalsPass()