4116 Commits

Author SHA1 Message Date
Simon Dardis
9331b2fae1 [mips] Mark microMIPS64 as being unsupported.
There are no provided instruction definitions for this architecture.

Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335057 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 16:05:44 +00:00
Simon Dardis
58b1f43714 [mips] Fix the predicates of some aliases
Previously, some aliases were marked as not being available for microMIPS32R6,
but this was overridden at the top level.

Reviewers: atanasyan, abeserminji, smaksimovic

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335053 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 15:25:01 +00:00
Simon Dardis
16d63b172e [mips] Add licensing information of the microMIPS tablegen files. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334827 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 13:29:35 +00:00
Simon Dardis
9a849b0187 [mips] Correct predicates for MSA pseudo instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 13:03:53 +00:00
Zoran Jovanovic
76b46df975 [mips][microMIPS] Extending size reduction pass with LWP and SWP
Author: milena.vujosevic.janicic
Reviewers: sdardis
The patch extends size reduction pass for MicroMIPS.
It introduces reduction of two instructions into one instruction:
Two SW instructions are transformed into one SWP instrucition.
Two LW instructions are transformed into one LWP instrucition.
Differential Revision: https://reviews.llvm.org/D39115


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334595 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 12:51:37 +00:00
Simon Dardis
a1847c760c [mips] Guard some floating point instructions correctly
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334491 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 10:28:06 +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
85edf48b76 [mips] Fix spill slot for mips3, n64 abi
When program is compiled for mips3 with n64 abi, wrong register class
is used for creating an emergency spill slot. This patch fixes the
correct register class to be chosen.

This patch resolves PR35859.

Thanks to John Baldwin for reporting the issue!

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 16:50:28 +00:00
Simon Dardis
7eabd93fbb [mips] Correct the predicates for a number of codegen only instructions
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334280 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-08 10:55:34 +00:00
Petar Jovanovic
a1a3a0ed7a [Mips] Silencing warnings in instruction info (NFC)
isORCopyInst and isReadOrWriteToDSPReg functions were producing warning
that some statements my fall through.

Patch by Nikola Prica.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334194 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 13:06:06 +00:00
Petar Jovanovic
adb3fd7c76 Change TII isCopyInstr way of returning arguments(NFC)
Make TII isCopyInstr() return MachineOperands through pointer to pointer
instead via reference.

Patch by Nikola Prica.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334105 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 16:36:30 +00:00
Peter Smith
e2b2a91087 [MC] Pass MCSubtargetInfo to fixupNeedsRelaxation and applyFixup
On targets like Arm some relaxations may only be performed when certain
architectural features are available. As functions can be compiled with
differing levels of architectural support we must make a judgement on
whether we can relax based on the MCSubtargetInfo for the function. This
change passes through the MCSubtargetInfo for the function to
fixupNeedsRelaxation so that the decision on whether to relax can be made
per function. In this patch, only the ARM backend makes use of this
information. We must also pass the MCSubtargetInfo to applyFixup because
some fixups skip error checking on the assumption that relaxation has
occurred, to prevent code-generation errors applyFixup must see the same
MCSubtargetInfo as fixupNeedsRelaxation.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 09:40:06 +00:00
Petar Jovanovic
e2b017e8ff [MIPS GlobalISel] Add lowerCall
Add minimal support to lower function calls.
Support only functions with arguments/return that go through registers
and have type i32.

Patch by Petar Avramovic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334071 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 07:24:52 +00:00
Amaury Sechet
e667d97117 [Mips] Remove uneeded variants of ADDC/ADDE lowering
Summary: As it turns out, the lowering for the Mips16* family of target is the exact same thing as what the ops expands to, so the code handling them can be removed and the ops only enabled for the MipsSE* family of targets.

Reviewers: smaksimovic, atanasyan, abeserminji

Subscribers: sdardis, arichardson, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334052 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 22:13:56 +00:00
Simon Dardis
8499c1a397 [mips] Fix the predicates for arithmetic operations
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334031 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 17:53:22 +00:00
Simon Dardis
49eaa4d1e0 [mips] Restore the availablity of trap for microMIPS
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333895 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 12:50:32 +00:00
Simon Atanasyan
d525a1e0b6 [mips] Support 64-bit offsets for lb/sb/ld/sd/lld ... instructions
The `MipsAsmParser::loadImmediate` can load immediates of various sizes
into a register. Idea of this change is to use `loadImmediate` in the
`MipsAsmParser::expandMemInst` method to load offset into a register and
then call required load/store instruction.

The patch removes separate `expandLoadInst` and `expandStoreInst`
methods and does everything in the `expandMemInst` method to escape code
duplication.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333774 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 16:37:53 +00:00
Simon Atanasyan
50fd0f624a [mips] Extend list of relocations supported by the .reloc directive
Supporting GOT and TLS related relocations by the `.reloc` directive is
useful for purpose of testing various tools like a linker, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333773 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 16:37:42 +00:00
Amaury Sechet
876db10e96 Set ADDE/ADDC/SUBE/SUBC to expand by default
Summary:
They've been deprecated in favor of UADDO/ADDCARRY or USUBO/SUBCARRY for a while.

Target that uses these opcodes are changed in order to ensure their behavior doesn't change.

Reviewers: efriedma, craig.topper, dblaikie, bkramer

Subscribers: jholewinski, arsenm, jyknight, sdardis, nemanjai, nhaehnle, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, mgrang, atanasyan, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333748 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 13:21:33 +00:00
Simon Dardis
1b58c0fb24 [mips] Guard more aliases correctly.
Also, duplicate an alias for microMIPS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333741 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 10:57:13 +00:00
Simon Dardis
aa33e079d2 [mips] Guard 'nop' properly and add mips16's nop instruction
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333739 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 10:46:00 +00:00
Simon Dardis
55b76bc78d [mips] Select the correct instruction for computing frameindexes
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333736 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 10:07:10 +00:00
Roman Tereshin
f911f7d95a [GlobalISel][Mips] LegalizerInfo verifier: Adding LegalizerInfo::verify(...) call for Mips
Reviewers: aemerson, qcolombet

Reviewed By: qcolombet

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 16:16:49 +00:00
Simon Dardis
a2207057d9 [mips] Guard all short instructions correctly.
Reviewers: smaksimovic, atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333645 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 12:47:01 +00:00
Simon Dardis
f5a87e6cf4 [mips] Correct the definition of CTC2/CFC2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333542 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 13:21:13 +00:00
Simon Dardis
a9aee862f0 [mips] Correct the predicates of microMIPS compact branch instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333541 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 13:16:17 +00:00
Simon Dardis
e4b4ace58e [mips] Sink PredicateControl further down the class hierarchy.
Previously PredicateControl in some cases was a member of <X>Inst classes
for some X (DSP, EVA) or was in more irregular place in the hierarchry
for any given instruction.

This patch moves PredicateControl down to the root so that it is consistently
available. Then correct the base class of microMIPS instructions as using
EncodingPredicates instead of the general Predicates field of Instruction.

Reviewers: smaksimovic, abeserminji, atanasyan

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333536 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 12:40:53 +00:00
Simon Dardis
056c0666f5 [mips] Correct the predicates of arithmetic and logic instructions.
As part of this effort, duplicate and correct the predicates of some
aliases. Also disable code generation of some short form instructions
for FastISel, as it would otherwise reject them.

Reviewers: atanasyan, abeserminji, smaksimovic

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 11:33:35 +00:00
Matt Arsenault
fec5a579e7 DAG: Remove redundant version of getRegisterTypeForCallingConv
There seems to be no real reason to have these separate copies.
The existing implementations just copy each other for x86.
For Mips there is a subtle difference, which is just a bug
since it changes based on the context where which one was called.
Dropping this version, all tests pass. If I try to merge them
to match the removed version, a test fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333440 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 17:42:26 +00:00
Simon Atanasyan
fc06be5513 [mips] Process numeric register name in the .set assignment directive
Now LLVM assembler cannot process the following code and generates an
error. GNU tools support .set assignment directive with numeric register
name.

```
.set r4, 4

test.s:1:11: error: invalid token in expression
  .set r4, $4
           ^
```

This patch teach assembler to handle such directives correctly.
Unfortunately a numeric register name cannot be represented as an
expression. That's why we have to maintain a separate `StringMap`
in the `MipsAsmParser` to keep mapping between aliases names and
register numbers.

Differential revision: https://reviews.llvm.org/D47464

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333428 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 15:58:06 +00:00
Simon Atanasyan
cfb33a0de9 [mips] Emit R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_LO16 / HI16 relocations
Emit R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_LO16 and
R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_HI16 chains of
relocations for %lo(%neg(%gp_rel())) and %hi(%neg(%gp_rel()))
expressions in case of microMIPS.

Differential Revision: http://reviews.llvm.org/D47220

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333409 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 11:33:54 +00:00
Simon Atanasyan
30edd11e20 [mips] Emit R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations
Emit R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations for %higher()
and %highest() expressions in case of microMIPS. These relocations do
exactly the same things as R_MIPS_HIGHER / R_MIPS_HIGHEST, but for
consistency it's better to write microMIPS variants.

Differential Revision: http://reviews.llvm.org/D47219

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333407 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 10:27:44 +00:00
Simon Dardis
1b5b9b6170 [mips] Correct the predicates for a number of instructions.
Previously, their listed predicates were overridden at the scope level.

Reviewers: atanasyan, abeserminji, smaksimovic

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 09:56:19 +00:00
Simon Atanasyan
f6555fd47f [mips] Cleanup the code to reduce diff with the upcoming patches. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333404 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 09:51:33 +00:00
Simon Atanasyan
0b90c62a5f [mips] Escape else-after-return. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333403 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 09:51:28 +00:00
Simon Atanasyan
66039bf097 [mips] Stop parsing a .set assignment if the first argument is not an identifier
Before this fix the following code triggers two error messages. The
second one is at least useless:

  test.s:1:9: error: expected identifier after .set
    .set  123, $a0
          ^
  test-set.s:1:9: error: unexpected token, expected comma
    .set  123, $a0
          ^

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333402 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 09:51:22 +00:00
Simon Dardis
ca7ed383cb [mips] Fix the definitions of lwp, swp
Rather than using a regpair operand of these instructions, use two seperate
operands and a custom converter to handle the implicit second register operand.

Additionally, remove the microMIPS32R6 definition as its redundant.

Reviewers: atanasyan, abeserminji, smaksimovic

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333288 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 16:15:48 +00:00
Simon Atanasyan
3c819aac8c [mips] Remove duplicated code from the expandLoadInst. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333164 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 07:36:18 +00:00
Simon Atanasyan
6151d6d025 [mips] Remove redundant argument from expandLoadInst/expandStoreInst. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 07:36:11 +00:00
Simon Atanasyan
5c37d1e9ba [mips] Add precondition asserts to the expandLoadInst/expandStoreInst. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333162 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 07:36:06 +00:00
Simon Atanasyan
8b02838a9b [mips] Cleanup the code a bit. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333161 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 07:36:00 +00:00
Petar Jovanovic
e1ddf28f3f Silence warnings introduced with r333093
r333093 introduced several warnings (-Wlogical-not-parentheses,
-Wbool-compare).
Adding parentheses in MipsSEInstrInfo::isCopyInstr() to silence it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333097 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 16:27:51 +00:00
Petar Jovanovic
4d9795156d [X86][MIPS][ARM] New machine instruction property 'isMoveReg'
This property is needed in order to follow values movement between
registers. This property is used in TII to implement method that
returns true if simple copy like instruction is recognized, along
with source and destination machine operands.

Patch by Nikola Prica.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333093 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 15:28:28 +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
Simon Dardis
48f3050c47 [mips] Correct the predicates of the cache and pref instructions
Reviewers: atanasyan, abeserminji, smaksimovic

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332970 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 10:55:05 +00:00
Peter Collingbourne
09ac21d393 MC: Separate creating a generic object writer from creating a target object writer. NFCI.
With this we gain a little flexibility in how the generic object
writer is created.

Part of PR37466.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332868 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 19:20:29 +00:00
Peter Collingbourne
a8e9721d8d MC: Change MCAsmBackend::writeNopData() to take a raw_ostream instead of an MCObjectWriter. NFCI.
To make this work I needed to add an endianness field to MCAsmBackend
so that writeNopData() implementations know which endianness to use.

Part of PR37466.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332857 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 17:57:19 +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
Simon Dardis
e7c11b7093 [mips] Add microMIPSR6 ll/sc instructions.
Previously the compiler was using the microMIPSR3 variants, incorrectly.

Reviewers: atanasyan, abeserminji, smaksimovic

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


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