diff options
author | Fangrui Song <i@maskray.me> | 2021-08-04 12:45:17 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-08-04 12:45:18 -0700 |
commit | a1944386156dbbfae15dfc606a3728e08ac92cfe (patch) | |
tree | 25fda9656217854430368d6e913d350d077e9c71 /llvm/lib/CodeGen/CommandFlags.cpp | |
parent | 5edc886e900b12286ad86268461a3013c329118d (diff) | |
download | llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.zip llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.tar.gz llvm-a1944386156dbbfae15dfc606a3728e08ac92cfe.tar.bz2 |
[CodeGen] Add -align-loops
to `lib/CodeGen/CommandFlags.cpp`. It can replace
-x86-experimental-pref-loop-alignment=.
The loop alignment is only used by MachineBlockPlacement.
The implementation uses a new `llvm::TargetOptions` for now, as
an IR function attribute/module flags metadata may be overkill.
This is the llvm part of D106701.
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CommandFlags.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index f3cba62..e5f5da5 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -94,6 +94,7 @@ CGOPT(bool, ValueTrackingVariableLocations) CGOPT(bool, ForceDwarfFrameSection) CGOPT(bool, XRayOmitFunctionIndex) CGOPT(bool, DebugStrictDwarf) +CGOPT(unsigned, AlignLoops) codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { #define CGBINDOPT(NAME) \ @@ -452,6 +453,10 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { "strict-dwarf", cl::desc("use strict dwarf"), cl::init(false)); CGBINDOPT(DebugStrictDwarf); + static cl::opt<unsigned> AlignLoops("align-loops", + cl::desc("Default alignment for loops")); + CGBINDOPT(AlignLoops); + #undef CGBINDOPT mc::RegisterMCTargetOptionsFlags(); @@ -527,6 +532,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) { Options.ForceDwarfFrameSection = getForceDwarfFrameSection(); Options.XRayOmitFunctionIndex = getXRayOmitFunctionIndex(); Options.DebugStrictDwarf = getDebugStrictDwarf(); + Options.LoopAlignment = getAlignLoops(); Options.MCOptions = mc::InitMCTargetOptionsFromFlags(); |