summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2013-11-10 00:09:26 +0000
committerReed Kotler <rkotler@mips.com>2013-11-10 00:09:26 +0000
commit45c5927c5cd347500d69a3ea68ee01a6a97e25b3 (patch)
treed13eceb9b4a6d806eff083668129b9315ecbd479 /llvm/lib
parent442ecd22ca5fa965bf99c7dd2bec143178893c50 (diff)
downloadbcm5719-llvm-45c5927c5cd347500d69a3ea68ee01a6a97e25b3.tar.gz
bcm5719-llvm-45c5927c5cd347500d69a3ea68ee01a6a97e25b3.zip
Mostly finish up constant islands port for Mips for load constants.
Still need to finish the branch part. Still lots more review of the code, clean up and testing. llvm-svn: 194337
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsConstantIslandPass.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
index 83ef7f7b6b2..23c988e7154 100644
--- a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
+++ b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
@@ -66,6 +66,16 @@ static cl::opt<int> ConstantIslandsSmallOffset(
cl::desc("Make small offsets be this amount for testing purposes"),
cl::Hidden);
+//
+// For testing purposes we tell it to not use relaxed load forms so that it
+// will split blocks.
+//
+static cl::opt<bool> NoLoadRelaxation(
+ "mips-constant-islands-no-load-relaxation",
+ cl::init(false),
+ cl::desc("Don't relax loads to long loads - for testing purposes"),
+ cl::Hidden);
+
namespace {
@@ -169,6 +179,9 @@ namespace {
ConstantIslandsSmallOffset: MaxDisp;
return xMaxDisp;
}
+ void setMaxDisp(unsigned val) {
+ MaxDisp = val;
+ }
unsigned getLongFormMaxDisp() const {
return LongFormMaxDisp;
}
@@ -615,6 +628,8 @@ initializeFunctionInfo(const std::vector<MachineInstr*> &CPEMIs) {
Bits = 8;
Scale = 4;
LongFormOpcode = Mips::LwRxPcTcpX16;
+ LongFormBits = 16;
+ LongFormScale = 1;
break;
case Mips::LwRxPcTcpX16:
Bits = 16;
@@ -977,6 +992,7 @@ int MipsConstantIslands::findLongFormInRangeCPEntry
true)) {
DEBUG(dbgs() << "In range\n");
UserMI->setDesc(TII->get(U.getLongFormOpcode()));
+ U.setMaxDisp(U.getLongFormMaxDisp());
return 2; // instruction is longer length now
}
@@ -1214,9 +1230,10 @@ bool MipsConstantIslands::handleConstantPoolUser(unsigned CPUserIndex) {
// No water found.
// we first see if a longer form of the instrucion could have reached
// the constant. in that case we won't bother to split
-#ifdef IN_PROGRESS
- result = findLongFormInRangeCPEntry(U, UserOffset);
-#endif
+ if (!NoLoadRelaxation) {
+ result = findLongFormInRangeCPEntry(U, UserOffset);
+ if (result != 0) return true;
+ }
DEBUG(dbgs() << "No water found\n");
createNewWater(CPUserIndex, UserOffset, NewMBB);
OpenPOWER on IntegriCloud