Akira Hatanaka
af4211ad94
[mips] Make sure loads from lazy-binding entries do not get CSE'd or hoisted out
...
of loops.
Previously, two consecutive calls to function "func" would result in the
following sequence of instructions:
1. load $16, %got(func)($gp) // load address of lazy-binding stub.
2. move $25, $16
3. jalr $25 // jump to lazy-binding stub.
4. nop
5. move $25, $16
6. jalr $25 // jump to lazy-binding stub again.
With this patch, the second call directly jumps to func's address, bypassing
the lazy-binding resolution routine:
1. load $25, %got(func)($gp) // load address of lazy-binding stub.
2. jalr $25 // jump to lazy-binding stub.
3. nop
4. load $25, %got(func)($gp) // load resolved address of func.
5. jalr $25 // directly jump to func.
llvm-svn: 191591
2013-09-28 00:12:32 +00:00
Craig Topper
31ee5866de
Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
...
llvm-svn: 185540
2013-07-03 15:07:05 +00:00
Bill Wendling
ead89ef63e
Don't cache the instruction and register info from the TargetMachine, because
...
the internals of TargetMachine could change.
llvm-svn: 183493
2013-06-07 07:04:14 +00:00
Akira Hatanaka
1ff803f47b
Fix comment.
...
llvm-svn: 177899
2013-03-25 20:11:16 +00:00
Akira Hatanaka
e9e588dd72
[mips] Remove unused option. Fix 80-column violations.
...
llvm-svn: 176330
2013-03-01 02:17:02 +00:00
Akira Hatanaka
8f7bfb39be
[mips] Add the capability to search delay slot filling instructions in
...
successor basic blocks.
Currently this is off by default.
llvm-svn: 176329
2013-03-01 02:03:51 +00:00
Akira Hatanaka
e44e30ca5a
[mips] Add options to disable searching backward and in successor blocks.
...
llvm-svn: 176321
2013-03-01 01:02:36 +00:00
Akira Hatanaka
e01ff9dc60
[mips] Add capability to search in the forward direction for instructions that
...
can fill the delay slot.
Currently, this is off by default.
llvm-svn: 176320
2013-03-01 00:50:52 +00:00
Akira Hatanaka
f815db5bcb
[mips] Define helper function searchRange
...
No functionality change.
llvm-svn: 176318
2013-03-01 00:26:14 +00:00
Akira Hatanaka
50e174d95d
[mips] Rename function findDelayInstr to searchBackward.
...
llvm-svn: 176317
2013-03-01 00:20:16 +00:00
Akira Hatanaka
eb33ced08f
[mips] Define class MemDefsUses.
...
This class tracks dependence between memory instructions using underlying
objects of memory operands.
llvm-svn: 176313
2013-03-01 00:16:31 +00:00
Akira Hatanaka
979899e5cc
[mips] Use class RegDefsUses to track register defs and uses.
...
No functionality change.
llvm-svn: 176070
2013-02-26 01:30:05 +00:00
Akira Hatanaka
30f05f3dc7
[mips] Disallow moving load/store instructions past volatile instructions.
...
Unfortunately, I wasn't able to create a test case that demonstrates the
problem I was trying to fix with this patch.
llvm-svn: 175226
2013-02-14 23:54:40 +00:00
Akira Hatanaka
06bd138dad
[mips] Replace usage of SmallSet with BitVector, which is used to keep track of
...
defined and used registers. Also add a few helper functions to simplify the
code.
llvm-svn: 175224
2013-02-14 23:40:57 +00:00
Akira Hatanaka
1083eb175c
[mips] Fix comments and coding style violations. Declare functions to be const.
...
llvm-svn: 175222
2013-02-14 23:20:15 +00:00
Akira Hatanaka
dfd2f24d0c
[mips] Simplify code in function Filler::findDelayInstr.
...
1. Define and use function terminateSearch.
2. Use MachineBasicBlock::iterator instead of MachineBasicBlock::instr_iterator.
3. Delete the line which checks whether an instruction is a pseudo.
llvm-svn: 175219
2013-02-14 23:11:24 +00:00
Akira Hatanaka
a061281556
[mips] Make Filler a class and reduce indentation.
...
llvm-svn: 174666
2013-02-07 21:32:32 +00:00
Jakob Stoklund Olesen
97030e0c0e
Use the new MIBundleBuilder class in the Mips target.
...
This is the preferred way of creating bundled machine instructions.
llvm-svn: 169585
2012-12-07 04:23:40 +00:00
Chandler Carruth
ed0881b2a6
Use the new script to sort the includes of every file under lib.
...
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.
Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]
llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Akira Hatanaka
907f5f0ca7
[mips] Fix delay slot filler so that instructions with register operand $1 are
...
allowed in branch delay slot.
llvm-svn: 168131
2012-11-16 02:39:34 +00:00
Akira Hatanaka
4a08a4a8b6
Disable Mips' delay slot filler when optimization level is O0.
...
llvm-svn: 162589
2012-08-24 20:40:15 +00:00
Akira Hatanaka
9d957842e1
Add option disable-mips-delay-filler. Turn on mips' delay slot filler by
...
default.
Patch by Carl Norum.
llvm-svn: 162339
2012-08-22 02:51:28 +00:00
Akira Hatanaka
5fd22485a3
Fix coding style violations. Remove white spaces and tabs.
...
llvm-svn: 158471
2012-06-14 21:10:56 +00:00
Akira Hatanaka
5ac78681c1
Bundle jump/branch instructions with the instructions in the delay slot in
...
delay slot filler pass of MIPS, per suggestion of Jakob Stoklund Olesen.
This change, along with the fix in r158154, enables machine verification
to be run after delay slot filling.
llvm-svn: 158426
2012-06-13 23:25:52 +00:00
Jakob Stoklund Olesen
92a0083944
Switch some getAliasSet clients to MCRegAliasIterator.
...
MCRegAliasIterator can optionally visit the register itself, allowing
for simpler code.
llvm-svn: 157837
2012-06-01 20:36:54 +00:00
Akira Hatanaka
4773e67e0b
Add a command line option to skip the delay slot filler pass entirely for Mips.
...
The purpose of this option is to silence error messages issued by machine
verifier passes and enable them to run to the end. If this option is not
provided, -verify-machineinstrs complains when it discovers there is a
non-terminator instruction (an instruction that is in a delay slot) after the
first terminator in a basic block.
llvm-svn: 156790
2012-05-14 23:59:17 +00:00
Craig Topper
1d32658877
Use uint16_t to store register overlaps to reduce static data.
...
llvm-svn: 152001
2012-03-04 10:43:23 +00:00
Jia Liu
f54f60f3ce
remove blanks, and some code format
...
llvm-svn: 151625
2012-02-28 07:46:26 +00:00
Jia Liu
9f6101191b
remove Emacs-tag form .cpp files in Mips Backend, and fix some typo.
...
llvm-svn: 150805
2012-02-17 08:55:11 +00:00
Jia Liu
dd6c1cd4e8
add Emacs tag and fix some comment error in file headers
...
llvm-svn: 150775
2012-02-17 01:23:50 +00:00
Akira Hatanaka
9e1d369e3c
Tidy up. Simplify logic. No functional change intended.
...
llvm-svn: 146896
2011-12-19 19:52:25 +00:00
Evan Cheng
7f8e563a69
Add bundle aware API for querying instruction properties and switch the code
...
generator to it. For non-bundle instructions, these behave exactly the same
as the MC layer API.
For properties like mayLoad / mayStore, look into the bundle and if any of the
bundled instructions has the property it would return true.
For properties like isPredicable, only return true if *all* of the bundled
instructions have the property.
For properties like canFoldAsLoad, isCompare, conservatively return false for
bundles.
llvm-svn: 146026
2011-12-07 07:15:52 +00:00
Akira Hatanaka
c6b742f98a
Fix assertion string.
...
llvm-svn: 141197
2011-10-05 18:17:49 +00:00
Akira Hatanaka
426a804825
Make sure candidate for delay slot filler is not a return instruction.
...
llvm-svn: 141196
2011-10-05 18:16:09 +00:00
Akira Hatanaka
14e4149f4e
Add RA to the set of registers that are defined if instruction is a call.
...
llvm-svn: 141194
2011-10-05 18:11:44 +00:00
NAKAMURA Takumi
9ebdf46b5a
MipsDelaySlotFiller.cpp: Appease msvc to specify llvm::next() explicitly.
...
llvm-svn: 141174
2011-10-05 10:11:02 +00:00
Akira Hatanaka
02e760add3
Insert space.
...
llvm-svn: 141158
2011-10-05 02:22:49 +00:00
Akira Hatanaka
8e532eb92f
Do not examine variadic or implicit operands if instruction is a return (jr).
...
llvm-svn: 141157
2011-10-05 02:21:58 +00:00
Akira Hatanaka
0d7dfc0b1f
Clean up function Filler::delayHasHazard.
...
llvm-svn: 141156
2011-10-05 02:18:58 +00:00
Akira Hatanaka
7b204688e7
Remove function Filler::insertCallUses.
...
Record the registers used and defined by a call in Filler::insertDefsUses.
llvm-svn: 141154
2011-10-05 02:04:17 +00:00
Akira Hatanaka
d9c8aab894
Clean up Filler::findDelayInstr.
...
llvm-svn: 141152
2011-10-05 01:57:46 +00:00
Akira Hatanaka
e7b0697412
Remove function Filler::isDelayFiller. Check if I is the same instruction that
...
filled the last delay slot visited.
llvm-svn: 141151
2011-10-05 01:30:09 +00:00
Akira Hatanaka
5d4e4ea3d5
Clean up Filler::runOnMachineBasicBlock. Change interface of
...
Filler::findDelayInstr.
llvm-svn: 141150
2011-10-05 01:23:39 +00:00
Akira Hatanaka
9e6034444a
Define a statistic for the number of slots that were filled with useful
...
instructions (instructions that are not NOP).
llvm-svn: 141149
2011-10-05 01:19:13 +00:00
Akira Hatanaka
8b3666af1b
Remove unnecessary check. isDelayFiller(MBB, I) will evaluate to true before
...
I->getDesc().hasDelaySlot() does.
llvm-svn: 141148
2011-10-05 01:15:31 +00:00
Akira Hatanaka
7d398636a2
Add comments and move assignment statement. If sawStore is true, sawLoad does
...
not have to be set.
llvm-svn: 141147
2011-10-05 01:09:37 +00:00
Akira Hatanaka
b345b5c424
Correct description string of enable-mips-delay-filler.
...
llvm-svn: 141146
2011-10-05 01:06:57 +00:00
Akira Hatanaka
f2619ee3ff
Fill delay slot with useful instructions. Modified from Sparc's version of delay
...
slot filler.
Patch by Reed Kotler at Mips Technologies.
llvm-svn: 140825
2011-09-29 23:52:13 +00:00
Akira Hatanaka
4444daeec5
Drop support for Mips1 and Mips2.
...
llvm-svn: 139405
2011-09-09 20:45:50 +00:00
Evan Cheng
6cc775f905
- Rename TargetInstrDesc, TargetOperandInfo to MCInstrDesc and MCOperandInfo and
...
sink them into MC layer.
- Added MCInstrInfo, which captures the tablegen generated static data. Chang
TargetInstrInfo so it's based off MCInstrInfo.
llvm-svn: 134021
2011-06-28 19:10:37 +00:00
Akira Hatanaka
e24891251c
Reverse unnecessary changes made in r129606 and r129608. There is no change in functionality.
...
llvm-svn: 129612
2011-04-15 21:51:11 +00:00
Akira Hatanaka
aef55c8801
Fix lines that have incorrect indentation or exceed 80 columns. There is no change in functionality.
...
llvm-svn: 129606
2011-04-15 21:00:26 +00:00
Bruno Cardoso Lopes
fde21cfa64
Fix delay slot filler for non mips1 targets. Patch by Akira Hatanaka
...
llvm-svn: 121376
2010-12-09 17:31:11 +00:00
Bruno Cardoso Lopes
9c656fe815
Initial support for Mips32 and Mips32r2. Patch contributed by Akira Hatanaka (ahatanaka@mips.com)
...
llvm-svn: 118447
2010-11-08 21:42:32 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
...
ID member as the sole unique type identifier. Clean up APIs related to this change.
llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Dale Johannesen
3a8bd17fdb
Remove non-DebugLoc versions of BuildMI from IA64, Mips.
...
llvm-svn: 64438
2009-02-13 02:34:39 +00:00
Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Chris Lattner
03ad885039
rename TargetInstrDescriptor -> TargetInstrDesc.
...
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.
llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner
a98c679de0
Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
...
that it is cheap and efficient to get.
Move a variety of predicates from TargetInstrInfo into
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around. Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.
Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.
llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Bruno Cardoso Lopes
0b97ce752c
A Pass to insert Nops on intructions with DelaySlot
...
llvm-svn: 41150
2007-08-18 01:50:47 +00:00