summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2015-12-29 18:18:07 +0000
committerChad Rosier <mcrosier@codeaurora.org>2015-12-29 18:18:07 +0000
commit6b4326367ad95c39d83236cd30fb3e734f865157 (patch)
tree373d184f3787b3e31a1d6f89bc5959ec79adc6fd /llvm/lib/CodeGen
parente7d82283cd59e334aea02140dacd7c3d518b48bf (diff)
downloadbcm5719-llvm-6b4326367ad95c39d83236cd30fb3e734f865157.tar.gz
bcm5719-llvm-6b4326367ad95c39d83236cd30fb3e734f865157.zip
Add command line options to force function/loop alignments.
These are being added for testing purposes. http://reviews.llvm.org/D15648 llvm-svn: 256571
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp10
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp8
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index fcddf346cf6..f5e30564501 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -62,6 +62,11 @@ static cl::opt<unsigned> AlignAllBlock("align-all-blocks",
"blocks in the function."),
cl::init(0), cl::Hidden);
+static cl::opt<unsigned>
+ AlignAllLoops("align-all-loops",
+ cl::desc("Force the alignment of all loops in the function."),
+ cl::init(0), cl::Hidden);
+
// FIXME: Find a good default for this flag and remove the flag.
static cl::opt<unsigned> ExitBlockBias(
"block-placement-exit-block-bias",
@@ -1329,6 +1334,11 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {
if (!L)
continue;
+ if (AlignAllLoops) {
+ ChainBB->setAlignment(AlignAllLoops);
+ continue;
+ }
+
unsigned Align = TLI->getPrefLoopAlignment(L);
if (!Align)
continue; // Don't care about loop alignment.
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 80d30a5b131..ca4bb1c6ad4 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -47,6 +47,11 @@ using namespace llvm;
#define DEBUG_TYPE "codegen"
+static cl::opt<unsigned>
+ AlignAllFunctions("align-all-functions",
+ cl::desc("Force the alignment of all functions."),
+ cl::init(0), cl::Hidden);
+
void MachineFunctionInitializer::anchor() {}
//===----------------------------------------------------------------------===//
@@ -87,6 +92,9 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
Alignment = std::max(Alignment,
STI->getTargetLowering()->getPrefFunctionAlignment());
+ if (AlignAllFunctions)
+ Alignment = AlignAllFunctions;
+
FunctionNumber = FunctionNum;
JumpTableInfo = nullptr;
OpenPOWER on IntegriCloud