Commit Graph

6524 Commits

Author SHA1 Message Date
Chris Lattner 1f9053a83c do not sign extend characters input to isprint. This improves
compatibility with VC++.  Patch by Max Burke!

llvm-svn: 62813
2009-01-22 23:38:45 +00:00
Bob Wilson c2dc7ee5d0 Fix a minor bug in DAGCombiner's folding of SELECT. Folding "select C, 0, 1"
to "C ^ 1" is only valid when C is known to be either 0 or 1.  Most of the
similar foldings in this function only handle "i1" types, but this one appears
intentionally written to handle larger integer types.  If C has an integer
type larger than "i1", this needs to check if the high bits of a boolean
are known to be zero.  I also changed the comment to describe this folding as
"C ^ 1" instead of "~C", since that is what the code does and since the latter
would only be valid for "i1" types.  The good news is that most LLVM targets
use TargetLowering::ZeroOrOneBooleanContent so this change will not disable
the optimization; the bad news is that I've been unable to come up with a
testcase to demonstrate the problem.

I have also removed a "FIXME" comment for folding "select C, X, 0" to "C & X",
since the code looks correct to me.  It could be made more aggressive by not
limiting the type to "i1", but that would then require checking for
TargetLowering::ZeroOrNegativeOneBooleanContent.  Similar changes could be
done for the other SELECT foldings, but it was decided to be not worth the
trouble and complexity (see e.g., r44663).

llvm-svn: 62790
2009-01-22 22:05:48 +00:00
Dan Gohman 1f3411de47 Don't create ISD::FNEG nodes after legalize if they aren't legal.
Simplify x+0 to x in unsafe-fp-math mode. This avoids a bunch of
redundant work in many cases, because in unsafe-fp-math mode,
ISD::FADD with a constant is considered free to negate, so the
DAGCombiner often negates x+0 to -0-x thinking it's free, when
in reality the end result is -x, which is more expensive than x.

Also, combine x*0 to 0.

This fixes PR3374.

llvm-svn: 62789
2009-01-22 21:58:43 +00:00
Bob Wilson c58900504b Add SelectionDAG::getNOT method to construct bitwise NOT operations,
corresponding to the "not" and "vnot" PatFrags.  Use the new method
in some places where it seems appropriate.

llvm-svn: 62768
2009-01-22 17:39:32 +00:00
Sanjiv Gupta 4186ddfc5a Few targets like the tiny little PIC16 have only 16-bit pointers.
llvm-svn: 62763
2009-01-22 10:14:21 +00:00
Evan Cheng 4a0bf66eb8 Eliminate a couple of fields from TargetRegisterClass: SubRegClasses and SuperRegClasses. These are not necessary. Also eliminate getSubRegisterRegClass and getSuperRegisterRegClass. These are slow and their results can change if register file names change. Just use TargetLowering::getRegClassFor() to get the right TargetRegisterClass instead.
llvm-svn: 62762
2009-01-22 09:10:11 +00:00
Chris Lattner e09d631d8e fix a typo
llvm-svn: 62761
2009-01-22 07:21:55 +00:00
Dan Gohman 7e6b932f18 Simplify ReduceLoadWidth's logic: it doesn't need several different
special cases after producing the new reduced-width load, because the
new load already has the needed adjustments built into it. This fixes
several bugs due to the special cases, including PR3317.

llvm-svn: 62692
2009-01-21 15:17:51 +00:00
Duncan Sands be7e41481b Cleanup whitespace and comments, and tweak some
prototypes, in operand type legalization.  No
functionality change.

llvm-svn: 62680
2009-01-21 09:00:29 +00:00
Owen Anderson fe48dfa0f2 I accidentally removed this check in an earlier commit, which cause breakage in the pre alloc splitter.
llvm-svn: 62678
2009-01-21 08:18:03 +00:00
Scott Michel ed7d79fce4 CellSPU:
- Ensure that (operation) legalization emits proper FDIV libcall when needed.
- Fix various bugs encountered during llvm-spu-gcc build, along with various
  cleanups.
- Start supporting double precision comparisons for remaining libgcc2 build.
  Discovered interesting DAGCombiner feature, which is currently solved via
  custom lowering (64-bit constants are not legal on CellSPU, but DAGCombiner
  insists on inserting one anyway.)
- Update README.

llvm-svn: 62664
2009-01-21 04:58:48 +00:00
Sanjiv Gupta a70798cc9a Allow targets to legalize operations (with illegal operands) that produces multiple values. For example, a load with an illegal operand (a load produces two values, a value and chain).
llvm-svn: 62663
2009-01-21 04:48:39 +00:00
Owen Anderson be7a29de0b Be more aggressive about renumbering vregs after splitting them.
llvm-svn: 62639
2009-01-21 00:13:28 +00:00
Devang Patel 19f2dd794e Encode member accessibility.
llvm-svn: 62638
2009-01-21 00:08:04 +00:00
Devang Patel 6bbacbe372 Appropriately mark fowrad decls.
llvm-svn: 62625
2009-01-20 22:27:02 +00:00
Evan Cheng f1e873a221 Fix PR3243: a LiveVariables bug. When HandlePhysRegKill is checking whether the last reference is also the last def (i.e. dead def), it should also check if last reference is the current machine instruction being processed. This can happen when it is processing a physical register use and setting the current machine instruction as sub-register's last ref.
llvm-svn: 62617
2009-01-20 21:25:12 +00:00
Bill Wendling 2395916c87 Use "SINT_TO_FP" instead of "UINT_TO_FP" when getting the exponent. This was
causing the limited precision stuff to produce the wrong result for values in
the range [0, 1).

llvm-svn: 62615
2009-01-20 21:17:57 +00:00
Devang Patel bd7743d772 Fix struct member's debug info.
llvm-svn: 62610
2009-01-20 21:02:02 +00:00
Devang Patel 2333409d06 Need only one set of debug info versions enum.
llvm-svn: 62602
2009-01-20 19:22:03 +00:00
Evan Cheng c544cb0eca Change TargetInstrInfo::isMoveInstr to return source and destination sub-register indices as well.
llvm-svn: 62600
2009-01-20 19:12:24 +00:00
Devang Patel 6befc4d34e Fix global variable's address in a DIE.
llvm-svn: 62596
2009-01-20 18:55:39 +00:00
Devang Patel f0dae1aae3 Enable debug info for enums.
llvm-svn: 62594
2009-01-20 18:35:14 +00:00
Devang Patel 120e962243 Enable debug info for composite types.
llvm-svn: 62589
2009-01-20 18:13:03 +00:00
Evan Cheng 6cdcf1eb73 Refactor code. No functionality change.
llvm-svn: 62573
2009-01-20 06:44:16 +00:00
Bill Wendling 786a683441 Shift types need to match.
llvm-svn: 62571
2009-01-20 06:10:42 +00:00
Dan Gohman 161b7b66ac Fix a dagcombine to not generate loads of non-round integer types,
as its comment says, even in the case where it will be generating
extending loads. This fixes PR3216.

llvm-svn: 62557
2009-01-20 01:06:45 +00:00
Devang Patel af6a3748c7 Do not use DenseMap because the iterator is invalidated while constructing types. After all there was a reason why std::map was used initially!
llvm-svn: 62555
2009-01-20 00:58:55 +00:00
Evan Cheng 8f79775a66 Make linear scan's trivial coalescer slightly more aggressive.
llvm-svn: 62547
2009-01-20 00:16:18 +00:00
Devang Patel 44afc82ebe Verify debug info.
llvm-svn: 62545
2009-01-19 23:21:49 +00:00
Dan Gohman 534c8a2d72 Remove SDNode's virtual destructor. This makes it impossible for
SDNode subclasses to keep state that requires non-trivial
destructors, however it was already effectively impossible,
since the destructor isn't actually ever called. There currently
aren't any SDNode subclasses affected by this, and in general
it's desireable to keep SDNode objects light-weight.

This eliminates the last virtual member function in the SDNode
class, so it eliminates the need for a vtable pointer, making
SDNode smaller.

llvm-svn: 62539
2009-01-19 22:39:36 +00:00
Dan Gohman cd0b1bf0a0 Fix SelectionDAG::ReplaceAllUsesWith to behave correctly when
uses are added to the From node while it is processing From's
use list, because of automatic local CSE. The fix is to avoid
visiting any new uses.

Fix a few places in the DAGCombiner that assumed that after
a RAUW call, the From node has no users and may be deleted.

This fixes PR3018.

llvm-svn: 62533
2009-01-19 21:44:21 +00:00
Sanjiv Gupta 1d2fc787a9 Few targets like PIC16 wants libcall generation for illegal type i16.
llvm-svn: 62467
2009-01-18 18:25:27 +00:00
Mon P Wang e9e7abb6b8 Simplify extract element based on comments from Duncan Sands.
llvm-svn: 62459
2009-01-18 06:43:40 +00:00
Devang Patel 3f634fe364 Remove tabs.
llvm-svn: 62423
2009-01-17 08:05:14 +00:00
Devang Patel 8ee1c9f220 Refactor code
llvm-svn: 62421
2009-01-17 08:01:33 +00:00
Devang Patel bf7d432ce4 Assign argument type to appropriate DIE.
llvm-svn: 62412
2009-01-17 06:57:25 +00:00
Devang Patel 2e32f71dfa Remove dead code.
llvm-svn: 62410
2009-01-17 06:51:37 +00:00
Devang Patel d250ef911f Disable composite type debug info for now.
llvm-svn: 62406
2009-01-17 05:05:12 +00:00
Mon P Wang ca6d6dea0b Simplify extract element of a scalar to vector.
llvm-svn: 62383
2009-01-17 00:07:25 +00:00
Dan Gohman 5f8a2598b2 Instead of adding dependence edges between terminator instructions
and every other instruction in their blocks to keep the terminator
instructions at the end, teach the post-RA scheduler how to operate
on ranges of instructions, and exclude terminators from the range
of instructions that get scheduled.

Also, exclude mid-block labels, such as EH_LABEL instructions, and
schedule code before them separately from code after them. This
fixes problems with the post-RA scheduler moving code past
EH_LABELs.

llvm-svn: 62366
2009-01-16 22:10:20 +00:00
Dan Gohman 157e008816 If an anti-dependence uses a non-allocatable register, set AntiDepReg
to 0, to ensure that the subsequent code doesn't try to break the
dependence.

llvm-svn: 62365
2009-01-16 21:57:43 +00:00
Dan Gohman 38978ba972 Use the getNode() accessor instead of accessing the Node
member directly, which is private as of r55504.

llvm-svn: 62364
2009-01-16 21:47:21 +00:00
Dan Gohman 014142fd1a Fix the check for an empty basic block to check for an empty SUnits
array instead, since this is what the scheduler actually cares about.
And remove a check that is unnecessary, since it can assume that
SUnits isn't empty.

llvm-svn: 62362
2009-01-16 21:37:14 +00:00
Chris Lattner 41828cdb0a new nodes should be added to the worklist, not old nodes.
llvm-svn: 62359
2009-01-16 21:15:56 +00:00
Devang Patel 5d7813cb2d Fix comments.
llvm-svn: 62358
2009-01-16 21:07:53 +00:00
Evan Cheng 968e2e7b3d CreateVirtualRegisters does trivial copy coalescing. If a node def is used by a single CopyToReg, it reuses the virtual register assigned to the CopyToReg. This won't work for SDNode that is a clone or is itself cloned. Disable this optimization for those nodes or it can end up with non-SSA machine instructions.
llvm-svn: 62356
2009-01-16 20:57:18 +00:00
Devang Patel 0d733b5d9f Use lightweight DebugInfo objects directly.
llvm-svn: 62341
2009-01-16 19:28:14 +00:00
Devang Patel 867df54606 Align source code.
llvm-svn: 62328
2009-01-16 18:01:58 +00:00
Dan Gohman b903071735 Fix a "comparison between signed and unsigned integer expressions"
warning.

llvm-svn: 62327
2009-01-16 17:55:08 +00:00
Mikhail Glushenkov 6e8d814d36 Registry.h should not depend on CommandLine.h.
Split Support/Registry.h into two files so that we have less to
recompile every time CommandLine.h is changed.

llvm-svn: 62312
2009-01-16 07:02:28 +00:00
Mikhail Glushenkov b2f9a73029 Delete trailing whitespace.
llvm-svn: 62307
2009-01-16 06:53:46 +00:00
Devang Patel e067a7988c Validate debug info values only if DwarfDebug is initialized.
llvm-svn: 62298
2009-01-16 02:15:14 +00:00
Devang Patel 32fed1c0ef Any debug info symbol is only valid if atleast one compile unit is seen.
llvm-svn: 62294
2009-01-16 01:49:46 +00:00
Dan Gohman ceac7c34f1 Initial hazard recognizer support in post-pass scheduling. This includes
a new toy hazard recognizier heuristic which attempts to direct the
scheduler to avoid clumping large groups of loads or stores too densely.

llvm-svn: 62291
2009-01-16 01:33:36 +00:00
Devang Patel fa1b408b3b Do not stumble over forward declared struct member.
llvm-svn: 62288
2009-01-16 00:50:53 +00:00
Devang Patel 76d190cf4a Validate dbg_* intrinsics before lowering them.
llvm-svn: 62286
2009-01-15 23:41:32 +00:00
Mon P Wang e248edff1b Added missing support to widen an operand from a bit convert.
llvm-svn: 62285
2009-01-15 22:43:38 +00:00
Dan Gohman 7e105f0b12 Generalize the HazardRecognizer interface so that it can be used
to support MachineInstr-based scheduling in addition to
SDNode-based scheduling.

llvm-svn: 62284
2009-01-15 22:18:12 +00:00
Dan Gohman 79618d1de8 Simplify the MachineLICM pass by having it only traverse outer
loops, hoisting instructions all the way out in one step rather
than hoisting them one nest level at a time. Also, make a few
other code simplifications. This speeds up MachineLICM
by several fold.

llvm-svn: 62283
2009-01-15 22:01:38 +00:00
Rafael Espindola 6de96a1b5d Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Devang Patel 851cdaf1fd Use lightweight DebugInfo objects directly.
llvm-svn: 62276
2009-01-15 19:26:23 +00:00
Dan Gohman 619ef48a52 Move a few containers out of ScheduleDAGInstrs::BuildSchedGraph
and into the ScheduleDAGInstrs class, so that they don't get
destructed and re-constructed for each block. This fixes a
compile-time hot spot in the post-pass scheduler.

To help facilitate this, tidy and do some minor reorganization
in the scheduler constructor functions.

llvm-svn: 62275
2009-01-15 19:20:50 +00:00
Devang Patel 8bdc698336 Use variable's context to identify respective DbgScope.
Use light weight DebugInfo object directly.

llvm-svn: 62269
2009-01-15 18:25:17 +00:00
Dan Gohman 307954ac69 Make getWidenVectorType const; this file was missed in the
previous commit.

llvm-svn: 62266
2009-01-15 17:39:39 +00:00
Dan Gohman 91febd1330 More consts on TargetLowering references.
llvm-svn: 62262
2009-01-15 16:58:17 +00:00
Dan Gohman 4bdf021e05 Use const with TargetLowering references in a few more places.
llvm-svn: 62260
2009-01-15 16:43:02 +00:00
Gabor Greif 08a4c281cb minor refactoring: use a more specific API
llvm-svn: 62256
2009-01-15 11:10:44 +00:00
Devang Patel dedd3e1e14 Do not construct debug scope if RootScope *is* null.
llvm-svn: 62209
2009-01-14 01:34:32 +00:00
Devang Patel 3c82aa0209 Removoe MachineModuleInfo methods (and related DebugInfoDesc class hierarchy) that were used to handle debug info.
llvm-svn: 62199
2009-01-13 23:54:55 +00:00
Devang Patel 7b13aeedea Keep "has debug info" big in MachineModuleInfo to avoid circular dependency between AsmPrinter and CodeGen.
llvm-svn: 62191
2009-01-13 23:02:17 +00:00
Devang Patel fe9581f0cd Undo previous checkin.
llvm-svn: 62190
2009-01-13 22:54:57 +00:00
Devang Patel dd25a9d0aa Use DwarfWriter to record dbg variables.
llvm-svn: 62185
2009-01-13 21:44:10 +00:00
Devang Patel ca997988c3 Use dwarf writer to decide whether the module has debug info or not.
llvm-svn: 62184
2009-01-13 21:25:00 +00:00
Dan Gohman 5d4afb7bd9 Use assertions to check for conditions that should never happen.
llvm-svn: 62178
2009-01-13 20:25:24 +00:00
Dan Gohman 1407484178 The list-td and list-tdrr schedulers don't yet support physreg
scheduling dependencies. Add assertion checks to help catch
this.

It appears the Mips target defaults to list-td, and it has a
regression test that uses a physreg dependence. Such code was
liable to be miscompiled, and now evokes an assertion failure.

llvm-svn: 62177
2009-01-13 20:24:13 +00:00
Dan Gohman 13141d5538 Avoid referring to edge D after the Succs or Preds arrays have
been modified, to avoid trouble in the (unlikely) scenario that
D is a reference to an element in one of those arrays.

llvm-svn: 62173
2009-01-13 19:08:45 +00:00
Duncan Sands ffc6133318 When replacing uses and the same node is reached
via two paths, process it once not twice, d'oh!
Analysis, testcase and original patch thanks to
Mon Ping Wang.

llvm-svn: 62169
2009-01-13 15:17:14 +00:00
Duncan Sands 90d2a7bd72 Fix some typos. Also, the WidenedVectors map
was not being cleaned by ExpungeNode.

llvm-svn: 62167
2009-01-13 14:42:39 +00:00
Duncan Sands 013be76241 Correct a comment - this is not a sign extension.
llvm-svn: 62166
2009-01-13 14:04:14 +00:00
Evan Cheng 4f9c47aab9 Un-tabify.
llvm-svn: 62151
2009-01-13 06:08:37 +00:00
Evan Cheng f343168f1f FIX llvm-gcc bootstrap on x86_64 linux. If a virtual register is copied to a physical register, it's not necessarily defined by a copy. We have to watch out it doesn't clobber any sub-register that might be live during its live interval. If the live interval crosses a basic block, then it's not safe to check with the less conservative check (by scanning uses and defs) because it's possible a sub-register might be live out of the block.
llvm-svn: 62144
2009-01-13 03:57:45 +00:00
Devang Patel 5c6e1e3b7d Use DebugInfo interface to lower dbg_* intrinsics.
llvm-svn: 62127
2009-01-13 00:35:13 +00:00
Devang Patel f3456e8f07 Start using DebugInfo API to emit debug info.
llvm-svn: 62125
2009-01-13 00:20:51 +00:00
Devang Patel 243b4add9a Emit debug info, only if at least one compile unit is seen.
llvm-svn: 62118
2009-01-12 23:09:42 +00:00
Devang Patel b71fbeb19f If multiple compile units are seen then emit them independently. In other words, do not force all DIEs into first, whatever it is, compile unit.
Note, multiple compile unit support is not well tested (it did not work correctly until now anyway.)

llvm-svn: 62116
2009-01-12 23:05:55 +00:00
Devang Patel 4aa4128ced Avoid cast<>, use light weith wrapper directly.
llvm-svn: 62115
2009-01-12 22:58:14 +00:00
Devang Patel 4223582f00 Use SrcLineInfo from DwarfWriter. The MachineModuleInfo copy will disappear soon.
llvm-svn: 62114
2009-01-12 22:54:42 +00:00
Duncan Sands dc020f9c3c Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Devang Patel df31a7256d Add DwarfWriter interface to mainipulate source location info.
( May be this info should be directly handled by the dwarf writer ? )

llvm-svn: 62096
2009-01-12 19:17:34 +00:00
Devang Patel f033d53264 Clear debug info at the end of function processing.
llvm-svn: 62092
2009-01-12 18:48:36 +00:00
Devang Patel 5daa1abf25 There is no need to maintain separate labelid list in the dwarf writer. It is not a good idea.
llvm-svn: 62090
2009-01-12 18:41:00 +00:00
Evan Cheng b2c42c648d Fix PR3241: Currently EmitCopyFromReg emits a copy from the physical register to a virtual register unless it requires an expensive cross class copy. That means we are only treating "expensive to copy" register dependency as physical register dependency.
Also future proof the scheduler to handle "normal" physical register dependencies. The code is not exercised yet.

llvm-svn: 62074
2009-01-12 03:19:55 +00:00
Owen Anderson 45cfef2cb6 More two-address fixes. This gets lua working with join-creation enabled.
llvm-svn: 62073
2009-01-12 03:10:40 +00:00
Evan Cheng e3108148e2 CheckForPhysRegDependency should not return copy cost. It's not used. No functionality change.
llvm-svn: 62036
2009-01-11 08:53:35 +00:00
Devang Patel af7d04207c Reduce initial small vector sizes.
llvm-svn: 62023
2009-01-10 02:42:49 +00:00
Devang Patel 5491f25810 Fix thinko. Create parent scope if parent descriptor is *not* null.
llvm-svn: 62022
2009-01-10 02:34:18 +00:00
Evan Cheng ed74d8ac2a Duplicated node may produce a non-physical register def.
llvm-svn: 62015
2009-01-09 22:44:02 +00:00
Evan Cheng 0c4fe2600a Minor debug output tweak.
llvm-svn: 62005
2009-01-09 20:42:34 +00:00
Devang Patel 235acaa131 Request DwarfWriter. This will be used to handle dbg_* intrinsics.
llvm-svn: 61999
2009-01-09 19:11:50 +00:00
Misha Brukman 5cbf223916 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Devang Patel f646668799 Convert DwarfWriter into a pass.
Now Users request DwarfWriter through getAnalysisUsage() instead of creating an instance of DwarfWriter object directly.

llvm-svn: 61955
2009-01-08 23:40:34 +00:00
Dan Gohman f87dc9264a Delete unnecessary parens around return values.
llvm-svn: 61950
2009-01-08 22:19:34 +00:00
Devang Patel 65143c537c Add DebugInfo based APIs to record source line info.
llvm-svn: 61928
2009-01-08 17:19:22 +00:00
Misha Brukman 572f2646c2 * Moved author attribution to CREDITS.TXT
* Removed trailing whitespace

llvm-svn: 61927
2009-01-08 16:40:25 +00:00
Misha Brukman da46748ad2 * Alphabetized #includes
* Removed trailing whitespace

llvm-svn: 61926
2009-01-08 15:50:22 +00:00
Devang Patel 145a7cfa85 Add APIs to record regions and variables.
Again, shamelessly copied from MMI.

llvm-svn: 61912
2009-01-08 02:49:34 +00:00
Devang Patel fbbe93bf68 Add APIs to manage scope using DebugInfo interface.
This is a shameless copy of similar APIs from MachineModuleInfo. The copy from MMI will be deleted in near future.

llvm-svn: 61908
2009-01-08 02:33:41 +00:00
Dan Gohman 261ee6be57 Remove redundant 'else's. No functionality change.
llvm-svn: 61891
2009-01-07 22:30:55 +00:00
Evan Cheng f6768bd9cb The coalescer does not coalesce a virtual register to a physical register if any of the physical register's sub-register live intervals overlaps with the virtual register. This is overly conservative. It prevents a extract_subreg from being coalesced away:
v1024 = EDI  // not killed
      =
      = EDI

One possible solution is for the coalescer to examine the sub-register live intervals in the same manner as the physical register. Another possibility is to examine defs and uses (when needed) of sub-registers. Both solutions are too expensive. For now, look for "short virtual intervals" and scan instructions to look for conflict instead.

This is a small win on x86-64. e.g. It shaves 403.gcc by ~80 instructions.

llvm-svn: 61847
2009-01-07 02:08:57 +00:00
Dan Gohman c7847cdb8d Fix a bug in ComputeLinearIndex computation handling multi-level
aggregate types. Don't increment the current index after reaching
the end of a struct, as it will already be pointing at
one-past-the end. This fixes PR3288.

llvm-svn: 61828
2009-01-06 22:53:52 +00:00
Devang Patel 928d465b6b Set up DwarfDebug using DebugInfo API.
llvm-svn: 61822
2009-01-06 21:07:30 +00:00
Bill Wendling a055b8c0d3 Forgot that this was needed for Linux. This should fix the builds.
llvm-svn: 61819
2009-01-06 19:13:55 +00:00
Owen Anderson f04100a50d The phi construction algorithm used for interval reconstruction is complicated by
two address instructions.  We need to keep track of things we've processed AS USES
independetly of whether we've processed them as defs.

This fixes all known miscompilations when reconstruction is turned on.

llvm-svn: 61802
2009-01-06 07:53:32 +00:00
Dan Gohman bf8e5204d1 Update these argument lists for the isNormalMemory
argument. This doesn't affect current functionality.

llvm-svn: 61779
2009-01-06 01:28:56 +00:00
Dan Gohman 79c3516912 Use a latency value of 0 for the artificial edges inserted by
AddPseudoTwoAddrDeps. This lets the scheduling infrastructure
avoid recalculating node heights. In very large testcases this
was a major bottleneck. Thanks to Roman Levenstein for finding
this!

As a side effect, fold-pcmpeqd-0.ll is now scheduled better
and it no longer requires spilling on x86-32.

llvm-svn: 61778
2009-01-06 01:19:04 +00:00
Devang Patel 244a649764 Construct subprogram DIEs using DebugInfo.
llvm-svn: 61772
2009-01-05 23:21:35 +00:00
Devang Patel 245a73ac16 Construct global variable DIEs using DebugInfo.
llvm-svn: 61771
2009-01-05 23:11:11 +00:00
Devang Patel 0479d7647f Construct compile unit dies using DebugInfo.
llvm-svn: 61768
2009-01-05 23:03:32 +00:00
Bill Wendling f9b5ba7bcb Revert r61415 and r61484. Duncan was correct that these weren't needed.
llvm-svn: 61765
2009-01-05 22:53:45 +00:00
Dan Gohman 52d4d8244b Don't call setDepthDirty/setHeightDirty when adding an edge
with latency 0, since it doesn't affect the depth or height.

llvm-svn: 61762
2009-01-05 22:40:26 +00:00
Devang Patel ced6524437 Extract source location info from DebugInfo.
Add methods to add source location info in a DIE.

llvm-svn: 61761
2009-01-05 22:35:52 +00:00
Devang Patel c0a190085d Add type DIEs using DebugInfo.
llvm-svn: 61757
2009-01-05 21:47:57 +00:00
Devang Patel 1054a852b2 Construct composite type DIE using DebugInfo.
llvm-svn: 61741
2009-01-05 19:55:51 +00:00
Dan Gohman dbc6c31f62 TargetLowering.h #includes SelectionDAGNodes.h, so it doesn't need its
own OpActionsCapacity magic number; it can just use ISD::BUILTIN_OP_END,
as long as it takes care to round up when needed.

llvm-svn: 61733
2009-01-05 19:40:39 +00:00
Devang Patel 2c2eeabb54 s/ConstructType/ConstructTypeDIE/g
llvm-svn: 61731
2009-01-05 19:07:53 +00:00
Devang Patel 5024d377f2 Construct stuct field DIEs.
llvm-svn: 61729
2009-01-05 18:59:44 +00:00
Devang Patel c0adc6b9bc Construct enumerator DIE using DebugInfo.
llvm-svn: 61726
2009-01-05 18:38:38 +00:00
Devang Patel 758e7d7781 Construct array/vector type DIEs using DebugInfo.
llvm-svn: 61724
2009-01-05 18:33:01 +00:00
Owen Anderson 96fce00dc0 Get rid of sentinel insertion in interval reconstruction. It just masked the
problem, rather than fixing it.  The problem has now been fixed the right way.

llvm-svn: 61723
2009-01-05 18:32:26 +00:00
Dan Gohman 906152a20f Tidy up #includes, deleting a bunch of unnecessary #includes.
llvm-svn: 61715
2009-01-05 17:59:02 +00:00
Devang Patel 1e03f7f19e Construct basic and derived type DIEs using DebugInfo.
llvm-svn: 61714
2009-01-05 17:57:47 +00:00
Devang Patel 15deef2a3c subsume ConstructPointerType()
llvm-svn: 61711
2009-01-05 17:45:59 +00:00
Devang Patel ef2a94e8df subsume ConstructBasicType().
llvm-svn: 61709
2009-01-05 17:44:11 +00:00
Devang Patel 56a8bb670f squash warnings.
llvm-svn: 61707
2009-01-05 17:31:22 +00:00
Chris Lattner 8f561c9c97 elf writer really wants the size of the global, not the size
of the pointer to the global.

llvm-svn: 61630
2009-01-04 20:19:20 +00:00
Bill Wendling ac79602005 The llvm::ELFWriter::EmitGlobal() method is calling the
llvm::PATypeHolder::get() method when LLVM is self-hosted in Release
mode. Before the parser changed, there was a definition of llvm::PAHolder::get()
in llvmAsmParser.y. This was probably a bug that no-one noticed.

Explicitly #include the Type.h file as a temporary fix for now.

llvm-svn: 61620
2009-01-04 01:47:14 +00:00
Dan Gohman b9fa1d24f8 Fix a DAGCombiner abort on an invalid shift count constant. This fixes PR3250.
llvm-svn: 61613
2009-01-03 19:22:06 +00:00
Dan Gohman 4d41fdf4ca CommuteNodesToReducePressure() is now removed.
llvm-svn: 61612
2009-01-03 19:19:30 +00:00
Dan Gohman 1be2e9650e Remove the code from the scheduler that commuted two-address
instructions to avoid copies, because TwoAddressInstructionPass
also does this optimization.  The scheduler's version didn't
account for live-out values, which resulted in spurious commutes
and missed opportunities.

Now, TwoAddressInstructionPass handles all the opportunities,
instead of just those that the scheduler missed. The result is
usually the same, though there are occasional trivial differences
resulting from the avoidance of spurious commutes.

llvm-svn: 61611
2009-01-03 18:01:46 +00:00
Duncan Sands 953c9c2fbc Factorize (and generalize) the code promoting SELECT
and BRCOND conditions.  Reorder a few methods while
there.

llvm-svn: 61547
2009-01-01 20:36:20 +00:00
Duncan Sands 19ee60848a Remove trailing spaces.
llvm-svn: 61545
2009-01-01 19:56:02 +00:00
Duncan Sands 8feb694e8f Fix PR3274: when promoting the condition of a BRCOND node,
promote from i1 all the way up to the canonical SetCC type.
In order to discover an appropriate type to use, pass
MVT::Other to getSetCCResultType.  In order to be able to
do this, change getSetCCResultType to take a type as an
argument, not a value (this is also more logical).

llvm-svn: 61542
2009-01-01 15:52:00 +00:00
Owen Anderson 8b86b9ca47 Get live interval reconstruction several steps closer to working.
llvm-svn: 61514
2008-12-31 02:00:25 +00:00
Bill Wendling 03f2af79b8 Linux wants the FDE initial location and address range to be forced to 32-bit.
Darwin doesn't. Make this optional for platforms.

llvm-svn: 61484
2008-12-29 22:12:11 +00:00
Bill Wendling b13c83ac18 The FDE initial location and address range data should be free to be 64-bit
(quad) on a 64-bit platform. This fixes a problem with EH frames on Darwin.

llvm-svn: 61483
2008-12-29 21:51:42 +00:00
Duncan Sands 43b18241ff Add braces, as suggested by a gcc warning.
llvm-svn: 61465
2008-12-29 08:05:02 +00:00
Scott Michel 0c9259f149 Teach LeaglizeDAG that i64 mul can be a libcall.
llvm-svn: 61463
2008-12-29 03:21:37 +00:00
Owen Anderson b5232286a7 Fix up kill/dead marking in the new live interval reconstruction code.
llvm-svn: 61460
2008-12-28 23:35:13 +00:00
Owen Anderson 37751bb9d9 Add prototype code for recomputing a live interval's ranges and valnos through recursive phi construction.
llvm-svn: 61458
2008-12-28 21:48:48 +00:00
Bill Wendling d6bd7e9372 Darwin likes for the EH frame to be non-local.
llvm-svn: 61420
2008-12-24 08:05:17 +00:00
Bill Wendling 066b5f6724 GCC doesn't emit DW_EH_PE_sdata4 for the FDE encoding on Darwin. I'm not sure
about other platforms.

llvm-svn: 61415
2008-12-24 05:25:49 +00:00
Dale Johannesen ee573fcefc Change comments so everybody can understand them, hopefully.
llvm-svn: 61405
2008-12-23 23:47:22 +00:00
Dale Johannesen acc84e5aa0 Add another permutation where we should get rid of a-a.
llvm-svn: 61401
2008-12-23 23:01:27 +00:00
Anton Korobeynikov f4a66e8dda Restore debug printing
llvm-svn: 61398
2008-12-23 22:26:18 +00:00
Anton Korobeynikov d305d00796 Sometimes APInt syntax is really ugly... :(
llvm-svn: 61397
2008-12-23 22:26:01 +00:00
Anton Korobeynikov 05149bad18 Indent stuff properly
llvm-svn: 61396
2008-12-23 22:25:45 +00:00
Anton Korobeynikov 6f219132a7 Initial checkin of APInt'ififcation of switch lowering
llvm-svn: 61395
2008-12-23 22:25:27 +00:00
Devang Patel 70bd60d1d4 Fix typo.
Silence unused variable warning.

llvm-svn: 61391
2008-12-23 21:55:38 +00:00
Devang Patel 323dbe57a6 Silience unused warnings.
llvm-svn: 61390
2008-12-23 21:55:04 +00:00
Dan Gohman 12f2490489 Clean up the atomic opcodes in SelectionDAG.
This removes all the _8, _16, _32, and _64 opcodes and replaces each
group with an unsuffixed opcode. The MemoryVT field of the AtomicSDNode
is now used to carry the size information. In tablegen, the size-specific
opcodes are replaced by size-independent opcodes that utilize the
ability to compose them with predicates.

This shrinks the per-opcode tables and makes the code that handles
atomics much more concise.

llvm-svn: 61389
2008-12-23 21:37:04 +00:00
Dan Gohman 04543e719e Rename BuildSchedUnits to BuildSchedGraph, and refactor the
code in ScheduleDAGSDNodes' BuildSchedGraph into separate functions.

llvm-svn: 61376
2008-12-23 18:36:58 +00:00
Dan Gohman 072e52f170 Use isTerminator() instead of isBranch()||isReturn() in
several places. isTerminator() returns true for a superset
of cases, and includes things like FP_REG_KILL, which are
nither return or branch but aren't safe to move/remat/etc.

llvm-svn: 61373
2008-12-23 17:28:50 +00:00
Dan Gohman 92cf280dfb Avoid an unnecessary call to allnodes_size(), which is linear.
llvm-svn: 61372
2008-12-23 17:24:50 +00:00
Dan Gohman 3a57213e38 Minor code simplifications.
llvm-svn: 61371
2008-12-23 17:22:32 +00:00
Dale Johannesen d2a4685860 One more permutation of subtracting off a base value.
llvm-svn: 61361
2008-12-23 01:59:54 +00:00
Dan Gohman 014caa431c Refactor a bunch of code out of AsmPrinter::EmitGlobalConstant into separate
functions.

llvm-svn: 61345
2008-12-22 21:14:27 +00:00
Dan Gohman a04542b61e Optimize setDepthDirty and setHeightDirty a little, as they showed
up on a profile.

llvm-svn: 61344
2008-12-22 21:11:33 +00:00
Dan Gohman 24fe9a1dc2 Use SmallVector's pop_back_val.
llvm-svn: 61277
2008-12-20 16:42:33 +00:00
Dan Gohman bb92a1b815 Use the correct Preds and Succs lists in setHeightDirty()
and setDepthDirty(), respectively. This fixes PR3241.

llvm-svn: 61276
2008-12-20 16:34:57 +00:00
Dan Gohman 650b1e7ff8 Use ~0u instead of -1u as the special value, to hopefully avoid
warnings on compilers that warn about such things.

llvm-svn: 61263
2008-12-19 22:23:43 +00:00
Evan Cheng 0869f78555 Fix PR3149. If an early clobber def is a physical register and it is tied to an input operand, it effectively extends the live range of the physical register. Currently we do not have a good way to represent this.
172     %ECX<def> = MOV32rr %reg1039<kill>
180     INLINEASM <es:subl $5,$1
        sbbl $3,$0>, 10, %EAX<def>, 14, %ECX<earlyclobber,def>, 9, %EAX<kill>,
36, <fi#0>, 1, %reg0, 0, 9, %ECX<kill>, 36, <fi#1>, 1, %reg0, 0
188     %EAX<def> = MOV32rr %EAX<kill>
196     %ECX<def> = MOV32rr %ECX<kill>
204     %ECX<def> = MOV32rr %ECX<kill>
212     %EAX<def> = MOV32rr %EAX<kill>
220     %EAX<def> = MOV32rr %EAX
228     %reg1039<def> = MOV32rr %ECX<kill>

The early clobber operand ties ECX input to the ECX def.

The live interval of ECX is represented as this:
%reg20,inf = [46,47:1)[174,230:0)  0@174-(230) 1@46-(47)

The right way to represent this is something like
%reg20,inf = [46,47:2)[174,182:1)[181:230:0)  0@174-(182) 1@181-230 @2@46-(47)

Of course that won't work since that means overlapping live ranges defined by two val#.

The workaround for now is to add a bit to val# which says the val# is redefined by a early clobber def somewhere. This prevents the move at 228 from being optimized away by SimpleRegisterCoalescing::AdjustCopiesBackFrom.

llvm-svn: 61259
2008-12-19 20:58:01 +00:00
Chris Lattner 9c148c8fc2 Fix some release-assert warnings
llvm-svn: 61244
2008-12-19 17:03:38 +00:00
Rafael Espindola 770b4b830a Fix bug 3202.
The EH_frame and .eh symbols are now private, except for darwin9 and earlier.
The patch also fixes the definition of PrivateGlobalPrefix on pcc linux.

llvm-svn: 61242
2008-12-19 10:55:56 +00:00
Bill Wendling 19a54ffc7f Perform this loop only when the -debug flag is specified.
llvm-svn: 61238
2008-12-19 02:09:57 +00:00
Dan Gohman 8c82a8a984 Initialize the ImplicitDefed member, to avoid getting stale
data from a previous block.

llvm-svn: 61237
2008-12-19 00:46:20 +00:00
Dan Gohman 9abd04bf3f Teach LowerSubregs to preserve kill/dead information when lowering
subreg instructions.

llvm-svn: 61220
2008-12-18 22:14:08 +00:00
Dan Gohman c4ce336205 Make LowerSubregs' debug output for EXTRACT_SUBREG consistent with
that of INSERT_SUBREG and SUBREG_TO_REG.

llvm-svn: 61218
2008-12-18 22:11:34 +00:00
Dan Gohman d38c00c85b Fix a copy+pasto in an assertion message.
llvm-svn: 61217
2008-12-18 22:07:25 +00:00
Dan Gohman 451afdd9fe Fix indentation level.
llvm-svn: 61216
2008-12-18 22:06:01 +00:00
Dan Gohman 0ab1144c79 Print subreg information in MachineInstr::dump.
llvm-svn: 61213
2008-12-18 21:51:27 +00:00
Mon P Wang a501640ffa Added support for vector widening.
llvm-svn: 61209
2008-12-18 20:03:17 +00:00
Dan Gohman 83682a9441 Give MachineLICM a name, for -time-passes etc.
llvm-svn: 61184
2008-12-18 01:37:56 +00:00
Dan Gohman b0ef9140e5 Move post-RA scheduling before branch folding for now, because branch
folding's tail merging doesn't currently preserve liveness information
which post-RA scheduling requires.

llvm-svn: 61183
2008-12-18 01:36:42 +00:00
Owen Anderson ad4d2ab15b Re-apply r61158 in a form that no longer breaks tests.
llvm-svn: 61182
2008-12-18 01:27:19 +00:00
Owen Anderson 59727c0496 Revert r61158 for now, as it caused some test failures.
llvm-svn: 61159
2008-12-17 22:17:27 +00:00
Owen Anderson 9389176009 Fix miscompilations caused by renumbering, and enable it as part of prealloc splitting.
llvm-svn: 61158
2008-12-17 22:06:59 +00:00
Mon P Wang 015a7f57b2 Fix expansion of vsetcc to set the high bit for true instead of 1.
llvm-svn: 61129
2008-12-17 08:49:47 +00:00
Dan Gohman ce70fe2e25 Double the amount of memory reserved for SUnits. This is a
temporary workaround for an obscure bug. When node cloning is
used, it is possible that more SUnits will be created, and
if the SUnits std::vector has to reallocate, it will
invalidate all the graph edges.

llvm-svn: 61122
2008-12-17 04:30:46 +00:00
Dan Gohman 2a16bbe394 Use getDepth() and getHeight() instead of accessing the
Depth and Height members directly, as they may not be
current.

llvm-svn: 61121
2008-12-17 04:25:52 +00:00
Eli Friedman 6cf404f2d1 Fix for PR3225: disable a broken optimization in
DAGTypeLegalizer::ExpandShiftWithKnownAmountBit.

In terms of restoring the optimization, the best fix here isn't 
obvious... any ideas?

llvm-svn: 61119
2008-12-17 03:35:17 +00:00
Dale Johannesen f51dcef803 A new dag combine; several permutations of this
are there under ADD, this one was missing.

llvm-svn: 61107
2008-12-16 22:13:49 +00:00
Owen Anderson 5121ec3821 Add code to renumber split intervals into new vregs. This is disabled for now until I finish working out some iterator invalidation issues.
llvm-svn: 61104
2008-12-16 21:35:08 +00:00
Dan Gohman b4d41e802f Eliminate the loop that walks the critical path. Instead, just track the
position in the critical path during the main instruction walk.  This
eliminates the need for the CritialAntiDep DenseMap.

llvm-svn: 61096
2008-12-16 19:27:52 +00:00
Dan Gohman 4476ef810b Preserve SourceValue information when lowering produces multiple loads from
different offsets within the same stack slot.

llvm-svn: 61093
2008-12-16 18:25:36 +00:00
Evan Cheng c35fc49477 We have decided not to support inline asm where an output operand with a matching input operand with incompatible type (i.e. either one is a floating point and the other is an integer or the sizes of the types differ). SelectionDAGBuild will catch these and exit with an error.
llvm-svn: 61092
2008-12-16 18:21:39 +00:00
Dan Gohman 51559185f1 Enable anti-dependence breaking by default when post-RA scheduling is enabled.
llvm-svn: 61078
2008-12-16 06:21:45 +00:00
Dan Gohman 4302b4a63c When breaking an anti-dependency, don't use a register which has seen
one of its aliases defined. This is conservative, but tricky subreg
corner cases are outside the primary aim of this pass.

llvm-svn: 61077
2008-12-16 06:20:58 +00:00
Dan Gohman b9a012156b Add initial support for back-scheduling address computations,
especially in the case of addresses computed from loop induction
variables.

llvm-svn: 61075
2008-12-16 03:35:01 +00:00
Dan Gohman 405f2197a4 Remove some special-case logic in ScheduleDAGSDNodes's
latency computation code that is no longer needed with the
new method for handling latencies.

llvm-svn: 61074
2008-12-16 03:31:11 +00:00
Dan Gohman dddc1ac7ea Fix some register-alias-related bugs in the post-RA scheduler liveness
computation code. Also, avoid adding output-depenency edges when both
defs are dead, which frequently happens with EFLAGS defs.

Compute Depth and Height lazily, and always in terms of edge latency
values. For the schedulers that don't care about latency, edge latencies
are set to 1.

Eliminate Cycle and CycleBound, and LatencyPriorityQueue's Latencies array.
These are all subsumed by the Depth and Height fields.

llvm-svn: 61073
2008-12-16 03:25:46 +00:00