70 Commits

Author SHA1 Message Date
Peter Collingbourne
80e2a2f817 Target: Change various section classifiers in TargetLoweringObjectFile to take a GlobalObject.
These functions are about classifying a global which will actually be
emitted, so it does not make sense for them to take a GlobalValue which may
for example be an alias.

Change the Mach-O object writer and the Hexagon, Lanai and MIPS backends to
look through aliases before using TargetLoweringObjectFile interfaces. These
are functional changes but all appear to be bug fixes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285006 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 19:23:39 +00:00
Dylan McKay
acce8ee4fd [AVR] Add the machine code disassembler
This adds a super basic implementation of a machine code disassembler.

It doesn't support any operands with custom encoding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284930 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 23:57:59 +00:00
Dylan McKay
82ef6d6733 [AVR] Enable generation of the TableGen assembly writer tables
This also changes the order of the statements in CMakeLists.txt to be
alphabetical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283711 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 01:28:45 +00:00
Mehdi Amini
ae5f5d3d3c Move the global variables representing each Target behind accessor function
This avoids "static initialization order fiasco"

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283702 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 23:00:34 +00:00
Dylan McKay
97c245f629 [AVR] Add backend dependencies to MCTargetDesc/LLVMBuild.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:14:23 +00:00
Dylan McKay
b57fbc72a0 Fix incorrect assertion in AVRFrameLowering.cpp
This wasn't looking at the right instruction, and would always fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283640 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:10:36 +00:00
Dylan McKay
8af8e34e66 [AVR] Don't worry about call frame size when initializing frame pointer
We previously only used the frame pointer if the frame pointer was too
big. This was to work around a bug (described in this old commit)

https://sourceforge.net/p/avr-llvm/code/204/tree//llvm/trunk/AVR/AVRFrameLowering.cpp?diff=50d64d912718465cb887d17a:203

I mistakenly invered the condition assuming it was a typo. I am now
removing it because it doesn't seem to be a problem anymore (plus it's a
dirty hack).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:10:31 +00:00
Dylan McKay
ca1844d7ca [AVR] Don't shadow container while iterating in range-based loop
This works on clang, but fails on GCC 4.6

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:09:06 +00:00
Dylan McKay
056a448d96 [AVR] Use references rather than pointers in AVRISelLowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283636 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:06:21 +00:00
Dylan McKay
942ffca25d Allow a maximum of 64 bits to be returned in registers
The rest spills to the stack

Authored by Jake Goulding

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283635 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:05:09 +00:00
Dylan McKay
2884d8d5ee [AVR] Expand MULHS for all types
Once MULHS was expanded, this exposed an issue where the condition
register was thought to be 16-bit. This caused an attempt to copy a
16-bit register to an 8-bit register.

Authored by Jake Goulding

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:01:49 +00:00
Dylan McKay
dc87e8eb52 [AVR] Add the 'SoftFail' field to all instruction formats
This will be used in the future for disassembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283630 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:55:46 +00:00
Dylan McKay
db1d168abb [AVR] Set up the instruction printer and the assembly backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283629 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:50:11 +00:00
Dylan McKay
713cee592e [AVR] Add dependencies to AVR libraries in AVRCodeGen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:45:24 +00:00
Dylan McKay
8d09276103 [AVR] Add missing subdirectories to LLVMBuild
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283627 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:42:58 +00:00
Dylan McKay
a663737f9d [AVR] Add the assembly printer
Summary: This adds the AVRAsmPrinter class.

Reviewers: arsenm, kparzysz

Subscribers: llvm-commits, wdng, beanz, japaric, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283623 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:02:36 +00:00
Dylan McKay
61fdf5d8e9 [AVR] Add the AVRMCInstLower class
Summary:
This class deals with the lowering of CodeGen `MachineInstr` objects to
MC `MCInst` objects.

Reviewers: kparzysz, arsenm

Subscribers: wdng, beanz, japaric, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 06:13:09 +00:00
Dylan McKay
3beccae0ab [AVR] Don't select 'MOVW' instructions when they are not supported
We have a subtarget feature which we were ignoring, which was causing us
to generate unsupported instructions for some older chips.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 13:38:29 +00:00
Dylan McKay
3d6fe50568 [AVR] Add AVRRegisterInfo::splitReg function
No tests are included just yet - this is used from the pseudo
instruction expander pass, which hasn't been pulled in-tree yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 13:27:30 +00:00
Dylan McKay
27025b7f3c [AVR] Update return type of dynamic alloca pass
It was recently changed from 'const char*' to StringRef

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 12:32:24 +00:00
Dylan McKay
3aff1d4e47 [AVR] Add the AVR frame lowering code
Summary: This allows AVR to lower frames into assembly code.

Reviewers: arsenm, kparzysz

Subscribers: japaric, wdng, beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283311 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 11:48:56 +00:00
Dylan McKay
83aed6980d [AVR] Split all of the AVR device definitions into a separate file
We have ~500 lines of subtarget feature definitions, they don't belong
in our main TableGen file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 10:28:45 +00:00
Dylan McKay
fac3438f5e [AVR] Enable the instruction printer in the target definition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 10:23:38 +00:00
Dylan McKay
59cb8c3411 [AVR] Add definitions for the ATTiny102 and ATtiny104 chips
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 10:20:33 +00:00
Dylan McKay
bad1f71e1f [AVR] Add the machine code backend
Summary:
This adds the AVR machine code backend (`AVRAsmBackend.cpp`). This will
allow us to generate machine code from assembled AVR instructions.

Reviewers: arsenm, kparzysz

Subscribers: modocache, japaric, wdng, beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 05:30:19 +00:00
Dylan McKay
6f7cc3863c [AVR] Add the ELF object file writer
Summary: This adds the ELF32 writer for AVR.

Reviewers: kparzysz

Subscribers: beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282856 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 14:09:20 +00:00
Dylan McKay
cb9627faf5 [AVR] Add the assembly instruction printer
Summary:
This change adds the AVR assembly instruction printer.

No tests are included in this patch. I have left them downstream so we can
add them once `llc` successfully runs (there's very few components left
to upstream until this).

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 14:01:50 +00:00
Dylan McKay
22a65ba593 Revert "[AVR] Add instruction selection lowering code"
I accidentally comitted it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282712 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 12:49:18 +00:00
Dylan McKay
da4f4c9f4f [AVR] Add instruction selection lowering code
Summary: This adds AVRISelLowering.cpp

Reviewers: kparzysz, arsenm

Subscribers: wdng, beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282711 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 12:44:38 +00:00
Dylan McKay
3cdcff02c3 [AVR] Rename the builtin calling convention names
'BUILTIN' is clearer than 'RT' in this context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282602 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 16:04:40 +00:00
Dylan McKay
ed9eeccb0c [AVR] Import the LLVM namespace inside AVRMCTargetDesc.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 15:35:26 +00:00
Dylan McKay
f66c56cf4a [AVR] Add AVRMCTargetDesc.cpp
Summary:
This adds the AVRMCTargetDesc file in tree. It allows creation of the
core classes used in the backend.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 15:31:12 +00:00
Dylan McKay
478cda0308 [AVR] Update the signature of createAVRAsmBackend
It has been recently changed to also take a MCTargetOptions structure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 14:35:07 +00:00
Dylan McKay
fcd2ef9d8a [AVR] Enable the assembly parser
We very recently landed the code. This commit enables the parser.

It also adds a missing include to AVRAsmParser.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 14:34:42 +00:00
Dylan McKay
504fa868ab [AVR] Merge most recent changes to AVRInstrInfo.td
This adds two new things:

- Operand types per fixup
- Atomic pseudo operations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282588 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 13:44:02 +00:00
Dylan McKay
553362942d [AVR] Update the data layout
The previous data layout caused issues when dealing with atomics.

Foe example, it is illegal to load a 16-bit value with less than 16-bits
of alignment.

This changes the data layout so that all types are aligned by at least
their own width.

Interestingly, this also _slightly_ decreased register pressure in some
cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 13:29:10 +00:00
Dylan McKay
62464a3c92 [AVR] Add assembly parser
Summary: This patch adds the AVRAsmParser library.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, simoncook, jtbandes, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 13:02:57 +00:00
Dylan McKay
679be7ea7e [AVR] Add AVRMCExpr
Summary: This adds the AVRMCExpr headers and implementation.

Reviewers: arsenm, ruiu, grosbach, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, jtbandes, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 11:35:32 +00:00
Dylan McKay
2e99ba25d5 [AVR] Update signature of AVRTargetObjectFile::SelectSectionForGlobal
It was changed recently, and was breaking compilation of the backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 11:38:08 +00:00
Matt Arsenault
93e6e5414d Finish renaming remaining analyzeBranch functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 20:43:16 +00:00
Matt Arsenault
b1a710d5f0 Make analyzeBranch family of instruction names consistent
analyzeBranch was renamed to use lowercase first, rename
the related set to match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 17:24:15 +00:00
Matt Arsenault
ab302cda5e AArch64: Use TTI branch functions in branch relaxation
The main change is to return the code size from
InsertBranch/RemoveBranch.

Patch mostly by Tim Northover

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 17:23:48 +00:00
Justin Bogner
6673ea81f6 Replace "fallthrough" comments with LLVM_FALLTHROUGH
This is a mechanical change of comments in switches like fallthrough,
fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 05:10:15 +00:00
Job Noorman
9d30d1b1e5 [AVR] Fix compile errors
Differential Revision: https://reviews.llvm.org/D23450


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278784 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-16 08:41:35 +00:00
Sjoerd Meijer
c46479857e TargetInstrInfo: add virtual function getInstSizeInBytes
This adds a target hook getInstSizeInBytes to TargetInstrInfo that a lot of
subclasses already implement.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 08:16:16 +00:00
Matthias Braun
f79c57a412 MachineFunction: Return reference for getFrameInfo(); NFC
getFrameInfo() never returns nullptr so we should use a reference
instead of a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277017 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 18:40:00 +00:00
Sjoerd Meijer
7b78e6e140 TargetInstrInfo: rename GetInstSizeInBytes to getInstSizeInBytes. NFC
Differential Revision: https://reviews.llvm.org/D22925


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 16:32:22 +00:00
Jacques Pienaar
48ed4ab2d6 Rename AnalyzeBranch* to analyzeBranch*.
Summary: NFC. Rename AnalyzeBranch/AnalyzeBranchPredicate to analyzeBranch/analyzeBranchPredicate to follow LLVM coding style and be consistent with TargetInstrInfo's analyzeCompare and analyzeSelect.

Reviewers: tstellarAMD, mcrosier

Subscribers: mcrosier, jholewinski, jfb, arsenm, dschuff, jyknight, dsanders, nemanjai

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 14:41:04 +00:00
Duncan P. N. Exon Smith
a204da23db CodeGen: Use MachineInstr& in TargetLowering, NFC
This is a mechanical change to make TargetLowering API take MachineInstr&
(instead of MachineInstr*), since the argument is expected to be a valid
MachineInstr.  In one case, changed a parameter from MachineInstr* to
MachineBasicBlock::iterator, since it was used as an insertion point.

As a side effect, this removes a bunch of MachineInstr* to
MachineBasicBlock::iterator implicit conversions, a necessary step
toward fixing PR26753.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 22:52:52 +00:00
Duncan P. N. Exon Smith
567409db69 CodeGen: Use MachineInstr& in TargetInstrInfo, NFC
This is mostly a mechanical change to make TargetInstrInfo API take
MachineInstr& (instead of MachineInstr* or MachineBasicBlock::iterator)
when the argument is expected to be a valid MachineInstr.  This is a
general API improvement.

Although it would be possible to do this one function at a time, that
would demand a quadratic amount of churn since many of these functions
call each other.  Instead I've done everything as a block and just
updated what was necessary.

This is mostly mechanical fixes: adding and removing `*` and `&`
operators.  The only non-mechanical change is to split
ARMBaseInstrInfo::getOperandLatencyImpl out from
ARMBaseInstrInfo::getOperandLatency.  Previously, the latter took a
`MachineInstr*` which it updated to the instruction bundle leader; now,
the latter calls the former either with the same `MachineInstr&` or the
bundle leader.

As a side effect, this removes a bunch of MachineInstr* to
MachineBasicBlock::iterator implicit conversions, a necessary step
toward fixing PR26753.

Note: I updated WebAssembly, Lanai, and AVR (despite being
off-by-default) since it turned out to be easy.  I couldn't run tests
for AVR since llc doesn't link with it turned on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 00:01:54 +00:00