diff options
author | Aleksandar Beserminji <Aleksandar.Beserminji@mips.com> | 2018-05-21 10:20:02 +0000 |
---|---|---|
committer | Aleksandar Beserminji <Aleksandar.Beserminji@mips.com> | 2018-05-21 10:20:02 +0000 |
commit | de7be5e46f9eb3433fab194897859291e3dbc98f (patch) | |
tree | 07ff1d0e3e834115e6eb817f15430b5e21d4e8da /llvm/lib/Target/Mips/MipsTargetMachine.cpp | |
parent | becc204633c2f4b67df1a2f8892116777be8c575 (diff) | |
download | bcm5719-llvm-de7be5e46f9eb3433fab194897859291e3dbc98f.tar.gz bcm5719-llvm-de7be5e46f9eb3433fab194897859291e3dbc98f.zip |
[mips] Merge MipsLongBranch and MipsHazardSchedule passes
MipsLongBranchPass and MipsHazardSchedule passes are joined to one pass
because of mutual conflict. When MipsHazardSchedule inserts 'nop's, it
potentially breaks some jumps, so they have to be expanded to long
branches. When some branch is expanded to long branch, it potentially
creates a hazard situation, which should be fixed by adding nops.
New pass is called MipsBranchExpansion, it combines these two passes,
and runs them alternately until one of them reports no changes were made.
Differential Revision: https://reviews.llvm.org/D46641
llvm-svn: 332834
Diffstat (limited to 'llvm/lib/Target/Mips/MipsTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MipsTargetMachine.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/Target/Mips/MipsTargetMachine.cpp b/llvm/lib/Target/Mips/MipsTargetMachine.cpp index d360a9ebe36..755c824deb4 100644 --- a/llvm/lib/Target/Mips/MipsTargetMachine.cpp +++ b/llvm/lib/Target/Mips/MipsTargetMachine.cpp @@ -54,7 +54,7 @@ extern "C" void LLVMInitializeMipsTarget() { PassRegistry *PR = PassRegistry::getPassRegistry(); initializeGlobalISel(*PR); initializeMipsDelaySlotFillerPass(*PR); - initializeMipsLongBranchPass(*PR); + initializeMipsBranchExpansionPass(*PR); } static std::string computeDataLayout(const Triple &TT, StringRef CPU, @@ -290,12 +290,20 @@ MipsTargetMachine::getTargetTransformInfo(const Function &F) { void MipsPassConfig::addPreEmitPass() { addPass(createMicroMipsSizeReductionPass()); - // The delay slot filler and the long branch passes can potientially create - // forbidden slot/ hazards for MIPSR6 which the hazard schedule pass will - // fix. Any new pass must come before the hazard schedule pass. + // The delay slot filler pass can potientially create forbidden slot hazards + // for MIPSR6 and therefore it should go before MipsBranchExpansion pass. addPass(createMipsDelaySlotFillerPass()); - addPass(createMipsLongBranchPass()); - addPass(createMipsHazardSchedule()); + + // This pass expands branches and takes care about the forbidden slot hazards. + // Expanding branches may potentially create forbidden slot hazards for + // MIPSR6, and fixing such hazard may potentially break a branch by extending + // its offset out of range. That's why this pass combine these two tasks, and + // runs them alternately until one of them finishes without any changes. Only + // then we can be sure that all branches are expanded properly and no hazards + // exists. + // Any new pass should go before this pass. + addPass(createMipsBranchExpansion()); + addPass(createMipsConstantIslandPass()); } |