summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsConstantIslandPass.cpp
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
commit50d3b27f431a213a53a0240849a8ce65dc46c8a5 (patch)
tree0bb0c2d2073633ccc8b170d59f381bf57de76f9c /lib/Target/Mips/MipsConstantIslandPass.cpp
parent1343fbcb7e00b12b63ae90b8c211c2d42416a74f (diff)
downloadllvm-50d3b27f431a213a53a0240849a8ce65dc46c8a5.tar.gz
llvm-50d3b27f431a213a53a0240849a8ce65dc46c8a5.tar.bz2
llvm-50d3b27f431a213a53a0240849a8ce65dc46c8a5.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsConstantIslandPass.cpp')
-rw-r--r--lib/Target/Mips/MipsConstantIslandPass.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/Target/Mips/MipsConstantIslandPass.cpp b/lib/Target/Mips/MipsConstantIslandPass.cpp
index 83ef7f7b6b..23c988e715 100644
--- a/lib/Target/Mips/MipsConstantIslandPass.cpp
+++ b/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);