Commit Graph

792 Commits

Author SHA1 Message Date
Chris Lattner b2b9d6f0fb Change the 'global modification' APIs in SelectionDAG to take a new
DAGUpdateListener object pointer instead of just returning a vector 
of deleted nodes.  This makes the interfaces more efficient (no more
allocating a vector [at least a malloc], filling it in, then walking
it) and more clean.  This also allows the client to be notified of
nodes that are *changed* but not deleted.

llvm-svn: 46677
2008-02-03 06:49:24 +00:00
Evan Cheng 32e5347eb8 Get rid of the annoying blank lines before labels.
llvm-svn: 46667
2008-02-02 08:39:46 +00:00
Evan Cheng efd142a920 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.

llvm-svn: 46659
2008-02-02 04:07:54 +00:00
Evan Cheng 27b32b87ed Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
llvm-svn: 46623
2008-01-31 21:00:00 +00:00
Evan Cheng 1c6c16ea11 Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
llvm-svn: 46609
2008-01-31 09:59:15 +00:00
Christopher Lamb 0592cf7e74 Allow ComplexExpressions in InstrInfo.td files to be slightly more... complex! ComplexExpressions can now have attributes which affect how TableGen interprets
the pattern when generating matchin code. 

The first (and currently, only) attribute causes the immediate parent node of the ComplexPattern operand to be passed into the matching code rather than the node at the root of the entire DAG containing the pattern.

llvm-svn: 46606
2008-01-31 07:27:46 +00:00
Dan Gohman 3646fdda67 Create a new class, MemOperand, for describing memory references
in the backend. Introduce a new SDNode type, MemOperandSDNode, for
holding a MemOperand in the SelectionDAG IR, and add a MemOperand
list to MachineInstr, and code to manage them. Remove the offset
field from SrcValueSDNode; uses of SrcValueSDNode that were using
it are all all using MemOperandSDNode now.

Also, begin updating some getLoad and getStore calls to use the
PseudoSourceValue objects.

Most of this was written by Florian Brander, some
reorganization and updating to TOT by me.

llvm-svn: 46585
2008-01-31 00:25:39 +00:00
Scott Michel 167502a508 Fix to bug 1951: tblgen gratuitously renames variables when no temporary was
generated. This feature would only show up in fairly complex patterns, such
as this one in CellSPU:

  def : Pat<(add (SPUhi tconstpool:$in, 0), (SPUlo tconstpool:$in, 0)),
	    (IOHLlo (ILHUhi tconstpool:$in), tconstpool:$in)>;

which generated the following emit code:

SDNode *Emit_0(const SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1) DISABLE_INLINE {
  SDOperand N0 = N.getOperand(0);
  SDOperand N00 = N0.getOperand(0);
  SDOperand N01 = N0.getOperand(1);
  SDOperand N1 = N.getOperand(1);
  SDOperand N10 = N1.getOperand(0);
  SDOperand N11 = N1.getOperand(1);
  SDOperand Tmp3(CurDAG->getTargetNode(Opc0, VT0, N00), 0);
  return CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp2); /* Tmp2 s/b N00 */
}

Tested against the test suites without incident.

llvm-svn: 46487
2008-01-29 02:29:31 +00:00
Anton Korobeynikov 010bd77372 Add interator interface to DAGInit also
llvm-svn: 46250
2008-01-22 11:00:07 +00:00
Anton Korobeynikov e49cc26380 Provide iterator access to ListInit contents
llvm-svn: 46223
2008-01-21 22:30:26 +00:00
Chuck Rose III fe2714fab3 Add files to windows project files. Also include <algorithm> explicitly so that vstudio build works
llvm-svn: 46013
2008-01-15 21:43:17 +00:00
Evan Cheng 4d70ba3134 Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused parameters of CCStructAssign and add size and alignment requirement info.
llvm-svn: 45997
2008-01-15 03:34:58 +00:00
Evan Cheng a9ecdf6927 Revert my last commit. Not needed.
llvm-svn: 45994
2008-01-15 03:10:35 +00:00
Evan Cheng 02e78103ab ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.
llvm-svn: 45897
2008-01-12 01:07:41 +00:00
Chris Lattner c8226f32e9 Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Chris Lattner 317332fc2a Start inferring side effect information more aggressively, and fix many bugs in the
x86 backend where instructions were not marked maystore/mayload, and perf issues where
instructions were not marked neverHasSideEffects.  It would be really nice if we could
write patterns for copy instructions.

I have audited all the x86 instructions down to MOVDQAmr.  The flags on others and on
other targets are probably not right in all cases, but no clients currently use this
info that are enabled by default.

llvm-svn: 45829
2008-01-10 07:59:24 +00:00
Chris Lattner 70ddafaf45 Fix a crash on code like: let x = 1 {x
llvm-svn: 45827
2008-01-10 07:01:53 +00:00
Chris Lattner 86c458a178 if an instr lacks a pattern, assume it has side effects (unless never has s-e is true).
llvm-svn: 45823
2008-01-10 05:40:54 +00:00
Chris Lattner 42c63ef96e start inferring 'no side effects'.
llvm-svn: 45822
2008-01-10 05:39:30 +00:00
Chris Lattner 9e69654461 Infer mayload
llvm-svn: 45819
2008-01-10 04:44:48 +00:00
Chris Lattner 1ca2068227 realize that instructions who match intrinsics that read memory read memory.
Also, instructions with any nodes that are SDNPMayLoad also read memory.

llvm-svn: 45817
2008-01-10 04:38:57 +00:00
Chris Lattner 07fde9bde1 add a mayLoad property for machine instructions, a correlary to mayStore.
This is currently not set by anything.

llvm-svn: 45748
2008-01-08 18:05:21 +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 e99a6caee4 Rename all the M_* flags to be namespace qualified enums, and switch
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.

llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner f376c99ea0 rename hasVariableOperands() -> isVariadic(). Add some comments.
Evan, please review the comments I added to getNumDefs to make sure
that they are accurate, thx.

llvm-svn: 45687
2008-01-07 05:19:29 +00:00
Chris Lattner fd548c96cc Move M_* flags down in the file. Move SchedClass up in the
TargetInstrDescriptor class and shrink to 16-bits, saving a 
word in TargetInstrDescriptor.  Add some comments.

llvm-svn: 45686
2008-01-07 05:06:49 +00:00
Chris Lattner 6f8713decb the name field of instructions is never set to a non-empty string,
just unconditionally use the def name of the instruction.

llvm-svn: 45684
2008-01-07 04:57:31 +00:00
Chris Lattner e55e115616 Add predicates methods to TargetOperandInfo, and switch all clients
over to using them, instead of diddling Flags directly.  Change the
various flags from const variables to enums.

llvm-svn: 45677
2008-01-07 02:39:19 +00:00
Chris Lattner a4ce4f6987 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
llvm-svn: 45667
2008-01-06 23:38:27 +00:00
Chris Lattner 10324d0175 rename isStore -> mayStore to more accurately reflect what it captures.
llvm-svn: 45656
2008-01-06 08:36:04 +00:00
Chris Lattner a348f55ec6 Change the 'isStore' inferrer to look for 'SDNPMayStore'
instead of "ISD::STORE".  This allows us to mark target-specific dag
nodes as storing (such as ppc byteswap stores).  This allows us to remove
more explicit isStore flags from the .td files.

Finally, add a warning for when a .td file contains an explicit 
isStore and tblgen is able to infer it.

llvm-svn: 45654
2008-01-06 06:44:58 +00:00
Chris Lattner 89c6566577 set the 'isstore' flag for instructions whose pattern is an
intrinsic that writes to memory.

llvm-svn: 45650
2008-01-06 05:36:50 +00:00
Chris Lattner e457fd1e9b remove some old hacky code that tried to infer whether a store
occured in a pattern, but failed miserably.  The new code works for
any instruction that has a store in its pattern, including all the 
x86 mem op mem instructions.

The only target-independent code that uses this is branch folding,
so this won't change anything in practice.

llvm-svn: 45648
2008-01-06 02:16:26 +00:00
Chris Lattner 27a4c1515a rearrange some code to allow inferring instr info from the pattern of the instr, but don't do so yet.
llvm-svn: 45647
2008-01-06 01:53:37 +00:00
Chris Lattner d5326def4a improve const correctness.
llvm-svn: 45646
2008-01-06 01:52:22 +00:00
Chris Lattner ea2d52d867 Split the impl of CodeGenInstruction out to its own .cpp file, add a getName() accessor.
llvm-svn: 45645
2008-01-06 01:35:39 +00:00
Chris Lattner 85467a17ae final cleanups.
llvm-svn: 45644
2008-01-06 01:21:51 +00:00
Chris Lattner 626b89daa4 further simplifications and cleanup
llvm-svn: 45643
2008-01-06 01:20:13 +00:00
Chris Lattner 827efa451f simplify some code
llvm-svn: 45642
2008-01-06 01:12:44 +00:00
Chris Lattner ab3242fd46 rename CodegenDAGPatterns -> CodeGenDAGPatterns
llvm-svn: 45641
2008-01-06 01:10:31 +00:00
Chris Lattner e59a3c79e5 split enum emission out from InstrInfoEmitter into it's own tblgen backend.
llvm-svn: 45640
2008-01-06 00:49:05 +00:00
Chris Lattner 78ac0747e7 fix build on case sensitive file systems.
llvm-svn: 45639
2008-01-05 23:37:52 +00:00
Chris Lattner 7980bba549 now that computing CodegenDAGPatterns doesn't implicitly print stuff
out, DAGISelEmitter can compute it in its ctor, which simplifies some code.

Now we can use CodegenDAGPatterns in other parts of tblgen that want access
to dag pattern info, woo!

llvm-svn: 45636
2008-01-05 22:58:54 +00:00
Chris Lattner cc43e79bcd move Node Transformation printing from CodeGenDAGPatterns -> DAGISelEmitter.
The only difference in output is that we now print them in alphabetical 
order instead of reverse alphabetical order.

llvm-svn: 45635
2008-01-05 22:54:53 +00:00
Chris Lattner e7170df043 move predicate printing code from CodeGenDAGPatterns -> DAGISelEmitter.
llvm-svn: 45634
2008-01-05 22:43:57 +00:00
Chris Lattner 9abe77b2d0 fix a fixme by improving const correctness.
llvm-svn: 45633
2008-01-05 22:30:17 +00:00
Chris Lattner 8cab021ca2 change getQualifiedName to be a global function.
Split the pattern parsing code out from the dag isel emitter into it's own file.

No functionality change.

llvm-svn: 45632
2008-01-05 22:25:12 +00:00
Chris Lattner 69ea01446e Change the builtin matcher to emit a decision tree, which should help out
the VC++ 'nesting depth' issue.

llvm-svn: 45567
2008-01-04 04:38:35 +00:00
Chris Lattner a47634ecb1 Don't let IntrinsicID be uninitialized if it doesn't match.
llvm-svn: 45563
2008-01-04 03:32:52 +00:00
Bill Wendling ddc77f8e4c Remove the default else. This was ending in code that looked like this:
if (!strcmp(Target, "x86")) {
  // ...
}
else
  IntrinsicID = Intrinsic::not_intrinsic;

llvm-svn: 45557
2008-01-03 23:02:16 +00:00