1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

91 Commits

Author SHA1 Message Date
Evan Cheng
4a169be530 - 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
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Jakob Stoklund Olesen
30de09d279 Fix evil VirtRegRewriter bug.
The rewriter can keep track of multiple stack slots in the same register if they
happen to have the same value. When an instruction modifies a stack slot by
defining a register that is mapped to a stack slot, other stack slots in that
register are no longer valid.

This is a very rare problem, and I don't have a simple test case. I get the
impression that VirtRegRewriter knows it is about to be deleted, inventing a
last opaque problem.

<rdar://problem/9204040>

llvm-svn: 128562
2011-03-30 18:14:07 +00:00
Jakob Stoklund Olesen
41a7b0951b Teach VirtRegRewriter about the new virtual register numbers. No functional change.
llvm-svn: 128561
2011-03-30 18:14:04 +00:00
Andrew Trick
ec08eae0aa VirtRegRewriter assertion fix.
Apparently it's ok for multiple operands to "kill" the same register.
Fixes PR9237.

llvm-svn: 126190
2011-02-22 06:52:56 +00:00
Evan Cheng
1a5aa79d0e Remove a duplicated check.
llvm-svn: 125625
2011-02-16 00:37:02 +00:00
Andrew Trick
6a24682579 VirtRegRewriter fix: update kill flags, which are used by the scavenger.
rdar://problem/8893967: JM/lencod miscompile at -arch armv7 -mthumb -O3

Added ResurrectKill to remove kill flags after we decide to reused a
physical register. And (hopefully) ensure that we call it in all the
right places.

Sorry, I'm not checking in a unit test given that it's a miscompile I
can't reproduce easily with a toy example. Failures in the rewriter
depend on a series of heuristic decisions maked during one of the many
upstream phases in codegen. This case would require coercing regalloc
to generate a couple of rematerialzations in a way that causes the
scavenger to reuse the same register at just the wrong point.

The general way to test this is to implement kill flags
verification. Then we could have a simple, robust compile-only unit
test. That would be worth doing if the whole pass was not about to
disappear. At this point we focus verification work on the next
generation of regalloc.

llvm-svn: 124442
2011-01-27 21:26:43 +00:00
Jakob Stoklund Olesen
59d3b89873 Teach VirtRegRewriter to update slot indexes when erasing instructions.
It was leaving dangling pointers in the slot index maps.

llvm-svn: 123334
2011-01-12 22:28:51 +00:00
Jakob Stoklund Olesen
8c5c268f05 Annotate VirtRegRewriter debug output with slot indexes.
llvm-svn: 123333
2011-01-12 22:28:48 +00:00
Evan Cheng
aa16fd02ad Do not model all INLINEASM instructions as having unmodelled side effects.
Instead encode llvm IR level property "HasSideEffects" in an operand (shared
with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check
the operand when the instruction is an INLINEASM.

This allows memory instructions to be moved around INLINEASM instructions.

llvm-svn: 123044
2011-01-07 23:50:32 +00:00
Evan Cheng
8b58b77d06 DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.
llvm-svn: 123031
2011-01-07 21:08:26 +00:00
Benjamin Kramer
96ac873014 Prune includes.
llvm-svn: 118342
2010-11-06 11:45:59 +00:00
Jakob Stoklund Olesen
ecf3e62010 Properly handle reloading and spilling around partial redefines in
LocalRewriter.

This is a bit of a hack that adds an implicit use operand to model the
read-modify-write nature of a partial redef. Uses and defs are rewritten in
separate passes, and a single operand would never be processed twice.

<rdar://problem/8518892>

llvm-svn: 116210
2010-10-11 18:10:36 +00:00
Chris Lattner
c9709f154d Per discussion with Sanjiv, remove the PIC16 target from mainline. When/if
it comes back, it will be largely a rewrite, so keeping the old codebase
in tree isn't helping anyone.

llvm-svn: 116190
2010-10-11 05:44:40 +00:00
Jakob Stoklund Olesen
c14c1d2e21 Extract method ProcessUses from LocalRewriter::RewriteMBB. Both parent and child
are still way too long, but it's a start.

No functional change intended.

llvm-svn: 116116
2010-10-08 22:14:41 +00:00
Jakob Stoklund Olesen
bd8da2d3ee Don't add <imp-def> operands during register rewriting.
LiveIntervals already adds <imp-def> operands for super-registers when a subreg
def defines the whole register. Thus, it is not necessary to do it again when
rewriting.

In fact, the super-register imp-defs caused miscompilations because the late
scheduler couldn't see that the super-register was read.

We still add super-reg <imp-use,kill> operands when rewriting virtuals to
physicals.

llvm-svn: 113299
2010-09-07 22:38:45 +00:00
Jakob Stoklund Olesen
0806eee7ae VirtRegRewriter checks for early clobbers before it reuses an available stack
slot.

Teach it to also check for early clobbered aliases, and early clobber operands
following the current operand.

This fixes the miscompilation in PR8044 where EC registers eax and ecx were
being used for inputs.

llvm-svn: 112988
2010-09-03 18:36:56 +00:00
Jakob Stoklund Olesen
e00538e23e Avoid using a live std::multimap iterator while editing the map. It looks like
we sometimes compare singular iterators, reported by ENABLE_EXPENSIVE_CHECKS.
This fixes PR7825.

llvm-svn: 110355
2010-08-05 18:12:19 +00:00
Jim Grosbach
4d81e796cb 80 column
llvm-svn: 109513
2010-07-27 17:38:47 +00:00
Jim Grosbach
7e561eb81c fix typo
llvm-svn: 109511
2010-07-27 17:14:29 +00:00
Jakob Stoklund Olesen
1fb08e33b9 Remove remaining calls to TII::isMoveInstr.
llvm-svn: 108556
2010-07-16 21:03:55 +00:00
Rafael Espindola
0c1a9aa248 Convert the last getPhysicalRegisterRegClass in VirtRegRewriter.cpp to
getMinimalPhysRegClass. It was used to produce spills, and it is better to
use the most specific class if possible.

Update getLoadStoreRegOpcode to handle GR32_AD.

llvm-svn: 108115
2010-07-12 00:52:33 +00:00
Rafael Espindola
a6c4d25f0f Convert uses of getPhysicalRegisterRegClass in VirtRegRewriter.cpp.
The first one was used just to call isSafeToMoveRegClassDefs. In
general, using a more specific reg class is better, in practice only
x86 implements that method and the results are always the same.

The second one is in FindFreeRegister and is used to check if a register
is in a register class, a much more direct call to contains is better as
it should cover more cases and is faster.

llvm-svn: 108093
2010-07-11 16:45:17 +00:00
Jakob Stoklund Olesen
f0d1bf23eb Replace copyRegToReg with COPY everywhere in lib/CodeGen except for FastISel.
llvm-svn: 108062
2010-07-10 22:42:59 +00:00
Jakob Stoklund Olesen
ccd252ca08 Change TII::foldMemoryOperand API to require the machine instruction to be
inserted in a MBB, and return an already inserted MI.

This target API change is necessary to allow foldMemoryOperand to call
storeToStackSlot and loadFromStackSlot when folding a COPY to a stack slot
reference in a target independent way.

The foldMemoryOperandImpl hook is going to change in the same way, but I'll wait
until COPY folding is actually implemented. Most targets only fold copies and
won't need to specialize this hook at all.

llvm-svn: 107991
2010-07-09 17:29:08 +00:00
Jakob Stoklund Olesen
7824ff3af8 Handle COPY in VirtRegRewriter.
llvm-svn: 107949
2010-07-09 01:27:19 +00:00
Jakob Stoklund Olesen
30aacf68b9 Convert EXTRACT_SUBREG to COPY when emitting machine instrs.
EXTRACT_SUBREG no longer appears as a machine instruction. Use COPY instead.

Add isCopy() checks in many places using isMoveInstr() and isExtractSubreg().
The isMoveInstr hook will be removed later.

llvm-svn: 107879
2010-07-08 16:40:22 +00:00
Dale Johannesen
8e578aac71 Cosmetic.
llvm-svn: 106865
2010-06-25 17:41:07 +00:00
Dale Johannesen
8cbc00b2ac Fix a case where an earlyclobber operand of an asm
is reused as an input.  PR 4118.  Testcase is too big,
as usual with bugs in this area, but there's one in
the PR.

llvm-svn: 106816
2010-06-25 00:49:43 +00:00
Jakob Stoklund Olesen
f0226fee37 Slightly change the meaning of the reMaterialize target hook when the original
instruction defines subregisters.

Any existing subreg indices on the original instruction are preserved or
composed with the new subreg index.

Also substitute multiple operands mentioning the original register by using the
new MachineInstr::substituteRegister() function. This is necessary because there
will soon be <imp-def> operands added to non read-modify-write partial
definitions. This instruction:

  %reg1234:foo = FLAP %reg1234<imp-def>

will reMaterialize(%reg3333, bar) like this:

  %reg3333:bar-foo = FLAP %reg333:bar<imp-def>

Finally, replace the TargetRegisterInfo pointer argument with a reference to
indicate that it cannot be NULL.

llvm-svn: 105358
2010-06-02 22:47:25 +00:00
Jakob Stoklund Olesen
924b84cf0f Teach VirtRegRewriter to handle spilling in instructions that have multiple
definitions of the virtual register.

This happens when spilling the registers produced by REG_SEQUENCE:

%reg1047:5<def>, %reg1047:6<def>, %reg1047:7<def> = VLD3d8 %reg1033, 0, pred:14, pred:%reg0

The rewriter would spill the register multiple times, dead store elimination
tried to keep up, but ended up cutting the branch it was sitting on.

llvm-svn: 104321
2010-05-21 16:36:13 +00:00
Evan Cheng
97fc5247c8 It's not safe eliminate copies where src and dst have different sub-register indices.
llvm-svn: 103450
2010-05-11 00:20:03 +00:00
Dan Gohman
497e752655 Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.

llvm-svn: 103194
2010-05-06 20:33:48 +00:00
Evan Cheng
80f3051bb7 Add argument TargetRegisterInfo to loadRegFromStackSlot and storeRegToStackSlot.
llvm-svn: 103193
2010-05-06 19:06:44 +00:00
Evan Cheng
8ea213f823 Remove DBG_VALUE which reference dead stack slots.
llvm-svn: 102654
2010-04-29 18:51:00 +00:00
John McCall
e20cc3b28c Fix a number of clang -Wsign-compare warnings that didn't have an obvious
solution.  The only reason these don't fire with gcc-4.2 is that gcc turns off
part of -Wsign-compare in C++ on accident.

llvm-svn: 100581
2010-04-06 23:35:53 +00:00
Evan Cheng
99617bac24 Code clean up. Move includes from VirtRegRewriter.h to VirtRegRewriter.cpp.
llvm-svn: 100532
2010-04-06 17:19:55 +00:00
Evan Cheng
e195c4f65d Avoid being influenced by the presence of dbg_value instructions.
llvm-svn: 99879
2010-03-30 05:49:07 +00:00
Dale Johannesen
5c20ece13a Debug info shouldn't affect kills.
llvm-svn: 99637
2010-03-26 19:21:26 +00:00
Jakob Stoklund Olesen
1c8c4e2bb2 Extract methods from LocalRewriter::RewriteMBB bringing it down to 666 lines.
llvm-svn: 98295
2010-03-11 23:04:34 +00:00
Jakob Stoklund Olesen
87f8d0c4f2 VirtRegRewriter spring cleaning. No functional change.
Move methods out of line and M-x whitespace-cleanup.
Promote common method arguments to member variables.

llvm-svn: 98207
2010-03-11 00:11:33 +00:00
Duncan Sands
b7bb8ab12e Uniformize the way these options are printed. Requested by
Russell Wallace.

llvm-svn: 96580
2010-02-18 14:37:52 +00:00
Jakob Stoklund Olesen
0a65533a38 Fix PR6283.
When coalescing with a physreg, remember to add imp-def and imp-kill when
dealing with sub-registers.

Also fix a related bug in VirtRegRewriter where substitutePhysReg may
reallocate the operand list on an instruction and invalidate the reg_iterator.
This can happen when a register is mentioned twice on the same instruction.

llvm-svn: 96072
2010-02-13 02:06:10 +00:00
Chris Lattner
72156036b9 fix a layering violation: VirtRegRewriter.cpp shouldn't use AsmPrinter.h.
llvm-svn: 95748
2010-02-10 01:23:18 +00:00
Chris Lattner
750bf54fc6 fix missing #includes.
llvm-svn: 95745
2010-02-10 01:17:36 +00:00
Chris Lattner
7acf9be6c4 move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h.  #include the new TargetOpcodes.h
into MachineInstr.  Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the 
codebase.

llvm-svn: 95687
2010-02-09 19:54:29 +00:00
Jakob Stoklund Olesen
03dea01d94 Add <imp-def> and <imp-kill> operands when replacing virtual sub-register defs and kills.
An instruction like this:

  %reg1097:1<def> = VMOVSR %R3<kill>, 14, %reg0

Must be replaced with this when substituting physical registers:

  %S0<def> = VMOVSR %R3<kill>, 14, %reg0, %D0<imp-def>

llvm-svn: 92812
2010-01-06 00:29:28 +00:00
David Greene
6000f59a50 Change errs() to dbgs().
llvm-svn: 92590
2010-01-05 01:25:52 +00:00
Chris Lattner
9ce833945e improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Jakob Stoklund Olesen
ab8e8a9bc9 Add MachineBasicBlock::getName, and use it in place of getBasicBlock()->getName.
Fix debug code that assumes getBasicBlock never returns NULL.

llvm-svn: 89428
2009-11-20 01:17:03 +00:00