Commit Graph

138 Commits

Author SHA1 Message Date
Dan Gohman 147d9fa57d Don't assume that only Uses can be kills. Defs are marked as kills initially
when there are no uses. This fixes a dangling-pointer bug, where pointers to
deleted instructions were not removed from kills lists. More info here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-July/009749.html

llvm-svn: 40131
2007-07-20 23:17:34 +00:00
Evan Cheng f9ef70560e Dead code.
llvm-svn: 39979
2007-07-17 20:01:19 +00:00
Evan Cheng e66f822ecc Replace std::set with SmallPtrSet.
llvm-svn: 37746
2007-06-27 05:23:00 +00:00
Evan Cheng d8417d9199 Properly handle kills of a physical register which has sub-registers that are read by later instructions.
llvm-svn: 37739
2007-06-26 21:03:35 +00:00
Evan Cheng fc2377d4ed When marking a register as being implicitly defined, make sure to clear its partial use info as well.
llvm-svn: 37046
2007-05-14 20:39:18 +00:00
Evan Cheng 9e17872c1d Eliminate MarkVirtRegAliveInBlock recursion.
llvm-svn: 36943
2007-05-08 19:00:00 +00:00
Devang Patel 8c78a0bff0 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel e95c6ad802 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel 09f162ca6a Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Evan Cheng 910c80851e Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.
llvm-svn: 36483
2007-04-26 19:00:32 +00:00
Evan Cheng ed23a1387e Minor bug.
llvm-svn: 36473
2007-04-26 08:24:22 +00:00
Evan Cheng 43a17fe826 Be careful when to add implicit kill / dead operands. Don't add them during / post reg-allocation.
llvm-svn: 36458
2007-04-26 01:40:09 +00:00
Evan Cheng d4549c5527 Clean up.
llvm-svn: 36449
2007-04-25 21:34:08 +00:00
Evan Cheng 0fbe14ab87 Data structure change to improve compile time (especially in debug mode).
llvm-svn: 36447
2007-04-25 19:34:00 +00:00
Evan Cheng 7818c03c6b Fix for PR1306.
- A register def / use now implicitly affects sub-register liveness but does
not affect liveness information of super-registers.
- Def of a larger register (if followed by a use later) is treated as
read/mod/write of a smaller register.

llvm-svn: 36434
2007-04-25 07:30:23 +00:00
Evan Cheng 4c53d321aa VarInfo::UsedBlocks is no longer used. Remove.
llvm-svn: 36250
2007-04-18 05:04:38 +00:00
Evan Cheng 8387cf1100 Keep track of number of uses within the function per virtual register.
llvm-svn: 36214
2007-04-17 20:22:11 +00:00
Evan Cheng f6f043332f Track the BB's where each virtual register is used.
llvm-svn: 35135
2007-03-17 09:29:54 +00:00
Evan Cheng df7949a8d0 If a virtual register is already marked alive in this block, that means it is
alive in one of the successor block. Do not add it to the kill list.

llvm-svn: 35041
2007-03-09 09:48:56 +00:00
Evan Cheng 91b0790297 Avoid variable shadowing.
llvm-svn: 35039
2007-03-09 06:02:17 +00:00
Evan Cheng f7ed82da10 Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
llvm-svn: 34428
2007-02-19 21:49:54 +00:00
Reid Spencer da81bf4d3e For PR1207:
Revert patches that caused the problem. Evan, please investigate and reapply
when you've discovered the problem.

llvm-svn: 34399
2007-02-19 03:20:00 +00:00
Evan Cheng ef932b067d - Use MRegister::regsOverlap().
- Allow LiveVariables to track liveness of more registers.

llvm-svn: 34379
2007-02-17 11:09:47 +00:00
Evan Cheng b612316f20 Allow any MachineBasicBlock (not just the entry block) to have live-in physical
registers. Make sure liveinterval analysis is correctly creating live ranges
for them.

llvm-svn: 34217
2007-02-13 01:30:55 +00:00
Bill Wendling 355fc5ad50 Removed more <iostream> includes
llvm-svn: 32321
2006-12-07 20:28:15 +00:00
Evan Cheng 70ec52896e Do away with kill / dead maps. Move kill / dead info onto MI's.
llvm-svn: 31759
2006-11-15 20:51:59 +00:00
Evan Cheng 8c9c6d71ed Add implicit def / use operands to MachineInstr.
llvm-svn: 31633
2006-11-10 08:43:01 +00:00
Reid Spencer de46e48420 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Bill Wendling 984f0ce06b Fix for PR929. The PHI nodes were being gone through for each instruction
in a successor block for every block...resulting in some O(N^k) algorithm
which wasn't very good for performance. Calculating this information up
front and keeping it in a map made it much faster.

llvm-svn: 30697
2006-10-03 07:20:20 +00:00
Chris Lattner 2cb238320d Only call isUse/isDef on register operands
llvm-svn: 30118
2006-09-05 20:19:27 +00:00
Chris Lattner f8f724a2b1 Move two methods out of line, make them work when the record for a machine
instruction includes physregs.

llvm-svn: 30061
2006-09-03 00:05:09 +00:00
Chris Lattner 3c9b2420df Eliminate RegisterAnalysis. RegisterPass now does all that is necessary.
llvm-svn: 29921
2006-08-27 22:30:17 +00:00
Jim Laskey 4b49c23571 Eliminate data relocations by using NULL instead of global empty list.
llvm-svn: 29250
2006-07-21 21:15:20 +00:00
Chris Lattner ee64b6b40f Remove a bunch more dead V9 specific stuff
llvm-svn: 28094
2006-05-04 01:26:39 +00:00
Chris Lattner be45b5e948 Add a LiveVariables::VarInfo::dump method
llvm-svn: 25080
2006-01-04 05:40:30 +00:00
Chris Lattner 2ea5c99eca Add section switching to common code generator code. Add a couple of
asserts.

llvm-svn: 24445
2005-11-21 07:06:27 +00:00
Chris Lattner eeacce5a60 Implement LiveVariables.h change
llvm-svn: 22994
2005-08-24 00:09:33 +00:00
Chris Lattner 469652752c adjust to new live variables interface
llvm-svn: 22992
2005-08-23 23:42:17 +00:00
Chris Lattner 91caf1d039 allow a virtual register to be associated with live-in values.
llvm-svn: 21927
2005-05-13 07:08:07 +00:00
Misha Brukman 835702a094 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Chris Lattner 4c6ab01a20 Consider the livein/out set for a function, allowing targets to not have to
use ugly imp_def/imp_uses for arguments and return values.

llvm-svn: 21180
2005-04-09 15:23:25 +00:00
Chris Lattner 1cffa73f2a Just in case, handle something that is both a use and a def.
llvm-svn: 19696
2005-01-19 17:11:51 +00:00
Chris Lattner 00c436824f When an instruction moves, make sure to update the VarInfo::Kills list as
well as all of teh other stuff in livevar. This fixes the compiler crash
on fourinarow last night.

llvm-svn: 19695
2005-01-19 17:09:15 +00:00
Chris Lattner 6180881673 Do not use variable sized arrays in C++, they are non-portable. Patch
contributed by Morten Ofstad

llvm-svn: 17217
2004-10-25 18:44:14 +00:00
Reid Spencer 7c16caa336 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Alkis Evlogimenos 6a099d439e Give a better assertion if we see a use before a def.
llvm-svn: 16135
2004-09-01 22:34:52 +00:00
Alkis Evlogimenos c227d73e5f Remove dead code.
llvm-svn: 16077
2004-08-28 22:43:31 +00:00
Alkis Evlogimenos 2c69803b61 Use newly added API in MRegisterInfo and don't expose the allocatable
register set anymore. Its users now use the MRegisterInfo API.

llvm-svn: 16061
2004-08-26 22:23:32 +00:00
Chris Lattner aef6c2a350 There is no need to store the MBB along with the MI any more, we can now
ask instructions for their parent.

llvm-svn: 14998
2004-07-19 07:04:55 +00:00
Chris Lattner a74cf5a7d9 Simplify the interface to LiveVariables::addVirtualRegister(Killed|Dead)
llvm-svn: 14997
2004-07-19 06:55:21 +00:00
Chris Lattner 5027de35ed Remove the DefBlock element of VarInfo. DefBlock is always DefInst->getParent()
llvm-svn: 14996
2004-07-19 06:26:50 +00:00
Chris Lattner d47909e00a Add checks to ensure that there are no unreachable blocks in the function
llvm-svn: 14725
2004-07-09 16:44:37 +00:00
Chris Lattner c85535c8be Now that MachineFunction/MachineBasicBlock keep a mapping of blocks to ID #'s
use them instead of a local LiveVariables numbering

llvm-svn: 14523
2004-07-01 06:15:32 +00:00
Chris Lattner 6c375e4926 Start using MBB numbers directly instead of going through the live variables
map.

llvm-svn: 14518
2004-07-01 04:29:47 +00:00
Chris Lattner 7c77fd50e7 Instead of building a private numbering of MBB's use brg's nifty auto-numbering.
Also convert df_iterator -> df_ext_iterator for subsequent stuff I'm doing.

llvm-svn: 14517
2004-07-01 04:24:29 +00:00
Misha Brukman 7d11fbf971 Convert tabs to spaces.
llvm-svn: 14373
2004-06-24 21:31:16 +00:00
Chris Lattner 2150542af9 Adjust to new TargetMachine interface
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Chris Lattner 5eb8094c2d Patch to fix PR337. Make sure to mark all aliased physical registers as used
when we see a read of a register.  This is important in cases like:

AL = ...
AH = ...

   = AX

The read of AX must make both the AL and AH defs live until the use.

llvm-svn: 13444
2004-05-10 05:12:43 +00:00
Chris Lattner c49a9a5d76 Stop LiveVariables from using BasicBlocks as part of the mapping, instead
use MachineBasicBlocks.  To do this, we traverse the Machine CFG instead of
the LLVM CFG, which is also *MUCH* more efficient by having fewer levels of
indirections and mappings.

llvm-svn: 13301
2004-05-01 21:24:24 +00:00
Alkis Evlogimenos a333b1382f Correctly update LiveVariables when an instruction changes
llvm-svn: 12561
2004-03-30 22:44:39 +00:00
Chris Lattner 604cc83933 Add an assert
llvm-svn: 12010
2004-02-29 22:01:51 +00:00
Alkis Evlogimenos 61719d48d2 Uncomment assertions that register# != 0 on calls to
MRegisterInfo::is{Physical,Virtual}Register. Apply appropriate fixes
to relevant files.

llvm-svn: 11882
2004-02-26 22:00:20 +00:00
Chris Lattner 4c988391e1 Fix an iterator invalidation problem. :(
llvm-svn: 11627
2004-02-19 18:32:29 +00:00
Chris Lattner afa9d7eb85 Add method to update livevar when an instruction moves
llvm-svn: 11625
2004-02-19 18:28:02 +00:00
Alkis Evlogimenos bbf53937a4 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

Also use MRegisterInfo::is{Physical,Virtual}Register where
appropriate.

llvm-svn: 11477
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos 80da865f77 Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.

llvm-svn: 11340
2004-02-12 02:27:10 +00:00
Chris Lattner b21ec54e61 Add #include
llvm-svn: 11285
2004-02-10 21:18:55 +00:00
Chris Lattner 5dd5be3ec3 Do not use MachineOperand::isVirtualRegister either!
llvm-svn: 11283
2004-02-10 21:12:22 +00:00
Chris Lattner 373fba5c1d Eliminate users of MachineOperand::isPhysicalRegister
llvm-svn: 11278
2004-02-10 20:41:10 +00:00
Chris Lattner bbd9a43d20 Ugh, perform an optimization that GCC should be able to do itself. This
speeds up livevar from .48/.32s -> .45/.31s in LLC on perlbmk

llvm-svn: 11217
2004-02-09 01:43:23 +00:00
Chris Lattner 26407384ec Only do stuff for the REAL number of physical registers we have, not 1024.
This speeds up live variables a lot, from .60/.39s -> .47/.26s in LLC, for
the first/second pass respectively.

llvm-svn: 11216
2004-02-09 01:35:21 +00:00
Chris Lattner c330b98c1c Finegrainify namespacification, use new MRegisterInfo::isVirtualRegister
method

llvm-svn: 11037
2004-01-31 21:27:19 +00:00
Chris Lattner 0770862334 Finegrainify namespacification
Implement LiveVariables::getIndexMachineBasicBlock

llvm-svn: 11018
2004-01-30 22:08:53 +00:00
Alkis Evlogimenos 9d0c3d21c8 Remove unneeded check (with the recent change in live variables a use
of a physical register is always dominated by a def).

llvm-svn: 10821
2004-01-13 21:16:25 +00:00
Alkis Evlogimenos ebbd66c042 Correctly compute live variable information for physical registers
when an implicitely defined register is later used by an alias. For example:

         call foo
         %reg1024 = mov %AL

The call implicitely defines EAX but only AL is used. Before this fix
no information was available on AL. Now EAX and all its aliases except
AL get defined and die at the call instruction whereas AL lives to be
killed by the assignment.

llvm-svn: 10813
2004-01-13 06:24:30 +00:00
Alkis Evlogimenos aaba4639f8 Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
    b) add isUse(), isDef()
    c) rename opHiBits32() to isHiBits32(),
              opLoBits32() to isLoBits32(),
              opHiBits64() to isHiBits64(),
              opLoBits64() to isLoBits64().

This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.

llvm-svn: 10461
2003-12-14 13:24:17 +00:00
Alkis Evlogimenos 9bced9455a Remove unecessary if statements when looping on ImplicitDefs.
llvm-svn: 10444
2003-12-13 01:20:58 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Alkis Evlogimenos 5f1f337d95 Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs
and TargetInstrDescriptor::ImplicitUses to always point to a null
terminated array and never be null. So there is no need to check for
pointer validity when iterating over those sets. Code that looked
like:

if (const unsigned* AS = TID.ImplicitDefs) {
  for (int i = 0; AS[i]; ++i) {
    // use AS[i]
  }
}

was changed to:

for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) {
  // use *AS
}

llvm-svn: 8960
2003-10-08 05:20:08 +00:00
Vikram S. Adve 7366fa1aa6 (1) Added special register class containing (for now) %fsr.
Fixed spilling of %fcc[0-3] which are part of %fsr.

(2) Moved some machine-independent reg-class code to class TargetRegInfo
    from SparcReg{Class,}Info.

(3) Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()
    and related functions and flags.  Fixed several bugs where only
    "isDef" was being checked, not "isDefAndUse".

llvm-svn: 6341
2003-05-27 00:05:23 +00:00
Chris Lattner 584bae4733 * Keep the BBMap around as long as the pass is live
* Change getVarInfo to take real virtual register numbers and offset them
  itself.  This has caused me so much grief, it's not even funny.

llvm-svn: 6115
2003-05-12 14:24:00 +00:00
Chris Lattner 5ab42e5739 Add a vector to keep track of which registers are allocatable. Remove FIXMEs
llvm-svn: 6015
2003-05-07 20:08:36 +00:00
Chris Lattner 9eb2172176 Re-add gross hack, it's still necessary. :(
llvm-svn: 6012
2003-05-06 21:44:54 +00:00
Chris Lattner 824698b891 Remove hideously nasty hack
llvm-svn: 6011
2003-05-06 21:32:39 +00:00
Chris Lattner f641fd08bc Minor cleanup
llvm-svn: 5976
2003-05-01 21:18:47 +00:00
Chris Lattner b4d58d7f9e Rename MachineInstrInfo -> TargetInstrInfo
llvm-svn: 5272
2003-01-14 22:00:31 +00:00
Chris Lattner cab0b442f2 New files
llvm-svn: 5262
2003-01-13 20:01:16 +00:00