Commit Graph

232 Commits

Author SHA1 Message Date
Hiroshi Inoue
0df653a65e fix trivial typos, NFC
succesor -> successor



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27 10:35:37 +00:00
Eugene Zelenko
e74c436b70 [CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 22:22:41 +00:00
Matthias Braun
f632627ec7 llc: Add ability to parse mir from stdin
- Add -x <language> option to switch between IR and MIR inputs.
- Change MIR parser to read from stdin when filename is '-'.
- Add a simple mir roundtrip test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304825 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 20:06:57 +00:00
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Matthias Braun
2144c5262f CodeGen: Refactor MIR parsing
When parsing .mir files immediately construct the MachineFunctions and
put them into MachineModuleInfo.

This allows us to get rid of the delayed construction (and delayed error
reporting) through the MachineFunctionInitialzier interface.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 00:44:35 +00:00
Tim Northover
837e2e977f MIR: remove explicit "noVRegs" property.
We can infer this from the incoming MIR, so there's no reason to
represent it with a special flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-30 21:28:57 +00:00
Matthias Braun
0cb25a2a10 MIParser/MIRPrinter: Compute block successors if not explicitely specified
- MIParser: If the successor list is not specified successors will be
  added based on basic block operands in the block and possible
  fallthrough.

- MIRPrinter: Adds a new `simplify-mir` option, with that option set:
  Skip printing of block successor lists in cases where the
  parser is guaranteed to reconstruct it. This means we still print the
  list if some successor cannot be determined (happens for example for
  jump tables), if the successor order changes or branch probabilities
  being unequal.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05 21:09:30 +00:00
Matthias Braun
5927be1ab4 MachineFrameInfo: Track whether MaxCallFrameSize is computed yet; NFC
This tracks whether MaxCallFrameSize is computed yet. Ideally we would
assert and fail when the value is queried before it is computed, however
this fails various targets that need to be fixed first.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 22:32:25 +00:00
Renato Golin
d907744fff Revert "[APInt] Fix a few places that use APInt::getRawData to operate within the normal API."
This reverts commit r301105, 4, 3 and 1, as a follow up of the previous
revert, which broke even more bots.

For reference:
Revert "[APInt] Use operator<<= where possible. NFC"
Revert "[APInt] Use operator<<= instead of shl where possible. NFC"
Revert "[APInt] Use ashInPlace where possible."

PR32754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301111 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 12:15:30 +00:00
Craig Topper
aeda136605 [APInt] Fix a few places that use APInt::getRawData to operate within the normal API.
getRawData exposes the internal type of the APInt class directly to its users. Ideally we wouldn't expose such an implementation detail.

This patch fixes a few of the easy cases by using truncate, extract, or a rotate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 06:41:11 +00:00
Justin Bogner
b86967b006 MIR: Allow parsing of empty machine functions
If you run llc -stop-after=codegenprepare and feed the resulting MIR
to llc -start-after=codegenprepare, you'll have an empty machine
function since we haven't run any isel yet. Of course, this only works
if the MIRParser believes you that this is okay.

This is essentially a revert of r241862 with a fix for the problem it
was papering over.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 19:32:41 +00:00
Oren Ben Simhon
05383dbf2b [MIR] Support Customed Register Mask and CSRs
The MIR printer dumps a string that describe the register mask of a function.
A static predefined list of register masks matches a static list of strings.
However when the register mask is not from the static predefined list, there is no descriptor string and the printer fails.
This patch adds support to custom register mask printing and dumping.
Also the list of callee saved registers (describing the registers that must be preserved for the caller) might be dynamic.
As such this data needs to be dumped and parsed back to the Machine Register Info.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 08:14:18 +00:00
Tim Northover
f4523b0efd ARM: avoid clobbering register in v6 jump-table expansion.
If we got unlucky with register allocation and actual constpool placement, we
could end up producing a tTBB_JT with an index that's already been clobbered.

Technically, we might be able to fix this situation up with a MOV, but I think
the constant islands pass is complex enough without having to deal with more
weird edge-cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:38:13 +00:00
Tim Northover
1a3fe2bfe6 MIR: parse & print the atomic parts of a MachineMemOperand.
We're going to need them very soon for GlobalISel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294992 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-13 22:14:08 +00:00
Ahmed Bougacha
cbd2ff78c0 [MIRParser] Allow generic register specification on operand.
This completes r292321 by adding support for generic registers, e.g.:

  %2:_(s32) = G_ADD %0, %1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292550 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-20 00:29:59 +00:00
Matthias Braun
c1fa0731c3 MIRParser: Allow regclass specification on operand
You can now define the register class of a virtual register on the
operand itself avoiding the need to use a "registers:" block.

Example: "%0:gr64 = COPY %rax"

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292321 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 00:59:19 +00:00
Quentin Colombet
1a4f1d7f0a [GlobalISel] More fix for the size vs. type typo. NFC.
I missed those in my previous commit (r290378).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290387 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22 22:50:34 +00:00
Quentin Colombet
6ac98f4ebb [MIRParser] Fix a typo in comment and error message.
We have long switched from size to type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22 21:56:35 +00:00
Quentin Colombet
17505810d0 [MIRParser] Non-generic virtual register may have a type.
When generic virtual registers get constrained, because of a use on a
target specific operation for instance, we end up with regular virtual
registers with a type and that's perfectly fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22 21:56:29 +00:00
Krzysztof Parzyszek
c27f000cc1 [MIRParser] Add parsing hex literals of arbitrary size as unsigned integers
The current code does not parse hex literals larger than 32-bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289943 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 13:58:01 +00:00
Krzysztof Parzyszek
d6ca3f019d Extract LaneBitmask into a separate type
Specifically avoid implicit conversions from/to integral types to
avoid potential errors when changing the underlying type. For example,
a typical initialization of a "full" mask was "LaneMask = ~0u", which
would result in a value of 0x00000000FFFFFFFF if the type was extended
to uint64_t.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 14:36:06 +00:00
Matthias Braun
40485c228c Move VariableDbgInfo from MachineModuleInfo to MachineFunction
VariableDbgInfo is per function data, so it makes sense to have it with
the function instead of the module.

This is a necessary step to have machine module passes work properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30 23:48:50 +00:00
Matthias Braun
14250381b8 Move FrameInstructions from MachineModuleInfo to MachineFunction
This is per function data so it is better kept at the function instead
of the module.

This is a necessary step to have machine module passes work properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30 23:48:42 +00:00
Geoff Berry
181c24a90c [MIRPrinter] Print raw branch probabilities as expected by MIRParser
Fixes PR28751.

Reviewers: MatzeB, qcolombet

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 19:37:24 +00:00
Chris Bieneman
92cb3eecbd [CMake] NFC. Updating CMake dependency specifications
This patch updates a bunch of places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 04:36:50 +00:00
Tom Stellard
5b9e507366 MIRParser: Add support for parsing vreg reg alloc hints
Reviewers: qcolombet, MatzeB

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 00:03:14 +00:00
Malcolm Parsons
4c12732226 Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: beanz, lattner, jlebar

Subscribers: jholewinski, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285832 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 16:43:50 +00:00
Krzysztof Parzyszek
b15c25855e [MIRParser] Parse lane masks for register live-ins
Differential Revision: https://reviews.llvm.org/D25530


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 21:06:45 +00:00
Tim Northover
4c7a4f453b MIRParser: allow types on registers with a RegBank.
This fixes some GlobalISel regression tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 20:50:04 +00:00
Matthias Braun
48d33540b6 MIRParser: generic register operands with types
This should fix the fallout of r283848.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 04:22:29 +00:00
Matthias Braun
8ee2011aa7 MIRParser: Rewrite register info initialization; mostly NFC
This changes MachineRegisterInfo to be initializes after parsing all
instructions. This is in preparation for upcoming commits that allow the
register class specification on the operand or deduce them from the
MCInstrDesc.

This commit removes the unused feature of having nonsequential register
numbers. This was confusing anyway as the vreg numbers would be
different after parsing when you had "holes" in your numbering.

This patch also introduces the concept of an incomplete virtual
register. An incomplete virtual register may be used during .mir parsing
to construct MachineOperands without knowing the exact register class
(or register bank) yet.

NFC except for some error messages.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 03:13:01 +00:00
Davide Italiano
648d6ac61e [MIRParser] Delete dead code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282098 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 18:26:08 +00:00
Mehdi Amini
d1e3c5aaec Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)
The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

This is a recommit of r281806 after fixing the accessor to return
a pointer instead of a reference and updating all the call-sites.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 06:00:02 +00:00
Mehdi Amini
f3f34d6443 [MIR Parser] Fix Build!
Last-second refactoring before push was bad idea...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 05:41:02 +00:00
Mehdi Amini
5f16c76bd0 MIR Parser: issue an error when the Context discard value names.
This is in line with the LLParser behavior

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281811 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 05:33:58 +00:00
Tim Northover
3d94178ab6 GlobalISel: remove "unsized" LLT
It was only really there as a sentinel when instructions had to have precisely
one type. Now that registers are typed, each register really has to have a type
that is sized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15 10:09:59 +00:00
Tim Northover
cdce758a72 GlobalISel: cache pointer sizes in LLT
Otherwise everything that needs to work out what size they are has to keep a
DataLayout handy, which is a bit silly and very annoying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15 09:20:34 +00:00
Tim Northover
7a92e735b6 GlobalISel: disambiguate types when printing MIR
Some generic instructions have multiple types. While in theory these always be
discovered by inspecting the single definition of each generic vreg, in
practice those definitions won't always be local and traipsing through a big
function to find them will not be fun.

So this changes MIRPrinter to print out the type of uses as well as defs, if
they're known to be different or not known to be the same.

On the parsing side, we're a little more flexible: provided each register is
given a type in at least one place it's mentioned (and all types are
consistent) we accept the MIR. This doesn't introduce ambiguity but makes
writing tests manually a bit less painful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 11:20:10 +00:00
Justin Lebar
c71d5b41ef [CodeGen] Split out the notions of MI invariance and MI dereferenceability.
Summary:
An IR load can be invariant, dereferenceable, neither, or both.  But
currently, MI's notion of invariance is IR-invariant &&
IR-dereferenceable.

This patch splits up the notions of invariance and dereferenceability at
the MI level.  It's NFC, so adds some probably-unnecessary
"is-dereferenceable" checks, which we can remove later if desired.

Reviewers: chandlerc, tstellarAMD

Subscribers: jholewinski, arsenm, nemanjai, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-11 01:38:58 +00:00
Tim Northover
59282d3fd2 GlobalISel: move type information to MachineRegisterInfo.
We want each register to have a canonical type, which means the best place to
store this is in MachineRegisterInfo rather than on every MachineInstr that
happens to use or define that register.

Most changes following from this are pretty simple (you need an MRI anyway if
you're going to be doing any transformations, so just check the type there).
But legalization doesn't really want to check redundant operands (when, for
example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
operand type field to encode these constraints and limit legalization's work.

As an added bonus, more validation is possible, both in MachineVerifier and
MachineIRBuilder (coming soon).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 11:46:34 +00:00
Zachary Turner
684da7277a [YAMLIO] Add the ability to map with context.
mapping a yaml field to an object in code has always been
a stateless operation.  You could still pass state by using the
`setContext` function of the YAMLIO object, but this represented
global state for the entire yaml input.  In order to have
context-sensitive state, it is necessary to pass this state in
at the granularity of an individual mapping.

This patch adds support for this type of context-sensitive state.
You simply pass an additional argument of type T to the
`mapRequired` or `mapOptional` functions, and provided you have
specialized a `MappingContextTraits<U, T>` class with the
appropriate mapping function, you can pass this context into
the mapping function.

Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D24162

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08 18:22:44 +00:00
Quentin Colombet
7e94389773 [MFProperties] Introduce a reset method with no argument.
This method allows to reset all the properties in one go.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 22:09:11 +00:00
Reid Kleckner
def731aa8a [MC] Move .cv_loc management logic out of MCContext
MCContext already has many tasks, and separating CodeView out from it is
probably a good idea. The .cv_loc tracking was modelled on the DWARF
tracking which lived directly in MCContext.

Removes the inclusion of MCCodeView.h from MCContext.h, so now there are
only 10 build actions while I hack on CodeView support instead of 265.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279847 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 17:58:37 +00:00
Matthias Braun
690a3cbc95 MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it
Rename AllVRegsAllocated to NoVRegs. This avoids the connotation of
running after register and simply describes that no vregs are used in
a machine function. With that we can simply compute the property and do
not need to dump/parse it in .mir files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279698 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25 01:27:13 +00:00
Matthias Braun
249a3152c0 MIRParser/MIRPrinter: Compute HasInlineAsm instead of printing/parsing it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 22:34:06 +00:00
Matthias Braun
da04ce1480 MachineRegisterInfo/MIR: Initialize tracksSubRegLiveness early, do not print/parser it
tracksSubRegLiveness only depends on the Subtarget and a cl::opt, there
is not need to change it or save/parse it in a .mir file.
Make the field const and move the initialization LiveIntervalAnalysis to the
MachineRegisterInfo constructor. Also cleanup some code and fix some
instances which better use MachineRegisterInfo::subRegLivenessEnabled() instead
of TargetSubtargetInfo::enableSubRegLiveness().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279676 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 22:17:45 +00:00
Matthias Braun
66489736bf MIRParser/MIRPrinter: Compute isSSA instead of printing/parsing it.
Specifying isSSA is an extra line at best and results in invalid MI at
worst. Compute the value instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279600 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 01:32:41 +00:00
Matthias Braun
db9ce2fda6 MachineFunction: Introduce NoPHIs property
I want to compute the SSA property of .mir files automatically in
upcoming patches. The problem with this is that some inputs will be
reported as static single assignment with some passes claiming not to
support SSA form.  In reality though those passes do not support PHI
instructions => Track the presence of PHI instructions separate from the
SSA property.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 21:19:49 +00:00
Tim Northover
4f24b7db0e GlobalISel: legalize integer comparisons on AArch64.
Next step is doing both legalizations at the same time! Marvel at GlobalISel's
cunning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 21:01:26 +00:00
Tim Northover
3ed44cd787 GlobalISel: support irtranslation of icmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:25:25 +00:00