5 Commits

Author SHA1 Message Date
Aleksandar Beserminji
82571dfdc1 [mips] Handle branch expansion corner cases
When potential jump instruction and target are in the same segment, use
jump instruction with immediate field.

In cases where offset does not fit immediate value of a bc/j instructions,
offset is stored into register, and then jump register instruction is used.

Differential Revision: https://reviews.llvm.org/D48019


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339126 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-07 10:45:45 +00:00
Aleksandar Beserminji
e0a1795624 [mips] Extend LONG_BRANCH_LUi/ADDiu with extra parameter
Extend LONG_BRANCH_LUi and LONG_BRANCH_ADDiu pseudo instructions with
additional flag, so instead of always lowering to lui %hi(...),
addiu %lo(...) or addiu %hi(...), now they can lower to either %lo, %hi,
%higher or %highest depending on the added flag.

Differential Revision: https://reviews.llvm.org/D47941


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 10:23:49 +00:00
Aleksandar Beserminji
643e7f6c91 [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332977 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 13:24:38 +00:00
Aleksandar Beserminji
edeb7b8e33 [mips] Revert Merge MipsLongBranch and MipsHazardSchedule passes
Revert this patch due buildbot failure.

Differential Revision: https://reviews.llvm.org/D46641



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 11:38:52 +00:00
Aleksandar Beserminji
b3845567bd [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 10:20:02 +00:00