1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

466 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
1b274fd5f0 Fix Bug 4657: register scavenger asserts with subreg lowering
When LowerSubregsInstructionPass::LowerInsert eliminates an INSERT_SUBREG
instriction because it is an identity copy, make sure that the same registers
are alive before and after the elimination.

When the super-register is marked <undef> this requires inserting an
IMPLICIT_DEF instruction to make sure the super register is live.

Fix a related bug where a kill flag on the inserted sub-register was not transferred properly.

Finally, clear the undef flag in MachineInstr::addRegisterKilled. Undef implies dead and kill implies live, so they cant both be valid.

llvm-svn: 77989
2009-08-03 20:08:18 +00:00
Jakob Stoklund Olesen
fe8f36d66b Never add a kill flag to a constrained physical register in a two-addr instruction.
llvm-svn: 77906
2009-08-02 19:13:03 +00:00
Evan Cheng
67f68983fe Fix a typo.
llvm-svn: 77369
2009-07-28 21:49:18 +00:00
Jakob Stoklund Olesen
96f9a917c8 Fix http://llvm.org/bugs/show_bug.cgi?id=4583
Inline asm instructions may have additional <imp-def,kill> register operands.
These operands are not marked with a flag like the normal asm operands, so we
must not assert that there is a flag.

llvm-svn: 76373
2009-07-19 19:09:59 +00:00
Jakob Stoklund Olesen
4a0d996780 Teach MachineInstr::isRegTiedToDefOperand() to correctly parse inline asm operands.
The inline asm operands must be parsed from the first flag, you cannot assume
that an immediate operand preceeding a register use operand is the flag.
PowerPC "m" operands are represented as (flag, imm, reg) triples.
isRegTiedToDefOperand() would incorrectly interpret the imm as the flag.

llvm-svn: 76101
2009-07-16 20:58:34 +00:00
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin
ae8a3ff177 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Evan Cheng
c6c942b70f Add a bit IsUndef to MachineOperand. This indicates the def / use register operand is defined by an implicit_def. That means it can def / use any register and passes (e.g. register scavenger) can feel free to ignore them.
The register allocator, when it allocates a register to a virtual register defined by an implicit_def, can allocate any physical register without worrying about overlapping live ranges. It should mark all of operands of the said virtual register so later passes will do the right thing.

This is not the best solution. But it should be a lot less fragile to having the scavenger try to track what is defined by implicit_def.

llvm-svn: 74518
2009-06-30 08:49:04 +00:00
Chris Lattner
cabe904f79 Rearrange some stuff in MachineOperand and add a new TargetFlags field.
llvm-svn: 74087
2009-06-24 17:54:48 +00:00
Evan Cheng
7292cadf06 Fix support for inline asm input / output operand tying when operand spans across multiple registers (e.g. two i64 operands in 32-bit mode).
llvm-svn: 74053
2009-06-24 02:05:51 +00:00
Dan Gohman
ee407d25ca Remove some unnecessary #includes.
llvm-svn: 72948
2009-06-05 16:32:58 +00:00
Argyrios Kyrtzidis
9956976b76 Make DebugLoc independent of DwarfWriter.
-Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable*
-Remove DwarfWriter::getOrCreateSourceID
-Make necessary changes for the above (fix callsites, etc.)

llvm-svn: 70520
2009-04-30 23:22:31 +00:00
Jakob Stoklund Olesen
0bfaaea2a4 MachineInstr::isRegTiedTo{Use,Def}Operand can safely be made const.
llvm-svn: 70408
2009-04-29 20:57:16 +00:00
Dan Gohman
420019a18a Fix MachineInstr::getNumExplicitOperands to count
variadic operands correctly. Patch by Jakob Stoklund Olesen!

llvm-svn: 69190
2009-04-15 17:59:11 +00:00
Dan Gohman
c9b68844d6 Give RemoveRegOperandFromRegInfo a comment and move the
code out of line.

llvm-svn: 69124
2009-04-15 01:17:37 +00:00
Chris Lattner
4c5310e25e ignore register zero in isRegTiedToUseOperand, following the example of
isRegTiedToDefOperand.  Thanks to Bob for pointing this out!

llvm-svn: 68734
2009-04-09 23:33:34 +00:00
Bob Wilson
c53238dff1 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).

llvm-svn: 68714
2009-04-09 17:16:43 +00:00
Chris Lattner
301c4f39a0 reg0 references are not real registers. This fixes a crash on the
attached testcase.

llvm-svn: 68712
2009-04-09 16:50:43 +00:00
Evan Cheng
2ec94dd447 Model inline asm constraint which ties an input to an output register as machine operand TIED_TO constraint. This eliminated the need to pre-allocate registers for these. This also allows register allocator can eliminate the unneeded copies.
llvm-svn: 67512
2009-03-23 08:01:15 +00:00
Evan Cheng
f47c144bff Added MachineInstr::isRegTiedToDefOperand to check for two-addressness.
llvm-svn: 67335
2009-03-19 20:30:06 +00:00
Bill Wendling
1c0692657d Print out debug info when printing the machine instruction.
llvm-svn: 65067
2009-02-19 21:44:55 +00:00
Dale Johannesen
718c678fde Add a DebugLoc field and some simple accessors.
llvm-svn: 63152
2009-01-27 23:20:29 +00:00
Dan Gohman
1c1b281cd5 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
47de8c174c Print subreg information in MachineInstr::dump.
llvm-svn: 61213
2008-12-18 21:51:27 +00:00
Dan Gohman
a52e83a6ca Minor code simplification.
llvm-svn: 60804
2008-12-09 22:45:08 +00:00
Dan Gohman
1e7dff35a6 Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
llvm-svn: 60586
2008-12-05 05:45:42 +00:00
Dan Gohman
04e99d0f3f Add more const qualifiers. This fixes build breakage from r59540.
llvm-svn: 59542
2008-11-18 19:49:32 +00:00
Dan Gohman
5926405b4a Make some methods const.
llvm-svn: 59540
2008-11-18 19:04:29 +00:00
Mon P Wang
3b3ab0fa30 Added missing print functions that take a raw_ostream
llvm-svn: 57339
2008-10-10 01:43:55 +00:00
Dan Gohman
30c5ce1b7d Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.

llvm-svn: 57006
2008-10-03 15:45:36 +00:00
Dan Gohman
c48242640d Fix a think-o in isSafeToMove. This fixes it from thinking that
volatile memory references are safe to move.

llvm-svn: 56948
2008-10-02 15:04:30 +00:00
Dale Johannesen
bc29bec7f8 Next round of earlyclobber handling. Approach the
RA problem by expanding the live interval of an
earlyclobber def back one slot.  Remove
overlap-earlyclobber throughout.  Remove 
earlyclobber bits and their handling from
live internals.

llvm-svn: 56539
2008-09-24 01:07:17 +00:00
Dan Gohman
0cf7b31c69 Add a method to MachineInstr for testing whether it makes
any volatile memory references.

llvm-svn: 56528
2008-09-24 00:06:15 +00:00
Dale Johannesen
99091ed94f Add a bit to mark operands of asm's that conflict
with an earlyclobber operand elsewhere.  Propagate
this bit and the earlyclobber bit through SDISel.
Change linear-scan RA not to allocate regs in a way 
that conflicts with an earlyclobber.  See also comments.

llvm-svn: 56290
2008-09-17 21:13:11 +00:00
Dale Johannesen
57fc1bdfdc adjust last patch per review feedback
llvm-svn: 56194
2008-09-14 01:44:36 +00:00
Dan Gohman
fa32c7c6d9 Remove isImm(), isReg(), and friends, in favor of
isImmediate(), isRegister(), and friends, to avoid confusion
about having two different names with the same meaning. I'm
not attached to the longer names, and would be ok with
changing to the shorter names if others prefer it.

llvm-svn: 56189
2008-09-13 17:58:21 +00:00
Dale Johannesen
6395da3510 Pass "earlyclobber" bit through to machine
representation; coalescer and RA need to know
about it.  No functional change.

llvm-svn: 56161
2008-09-12 17:49:03 +00:00
Dan Gohman
ec225915fa Fix addRegisterDead and addRegisterKilled to be more thorough
when searching for redundant subregister dead/kill bits.

Previously it was common to see instructions marked like this:
  "RET %EAX<imp-use,kill>, %AX<imp-use,kill>"

With this change, addRegisterKilled continues scanning after
finding the %EAX operand, so it proceeds to discover the
redundant %AX kill and eliminates it, producing this:
  "RET %EAX<imp-use,kill>"

This currently has no effect on the generated code.

llvm-svn: 55698
2008-09-03 15:56:16 +00:00
Evan Cheng
4cfcf9ca51 Fold isRematerializable checks into isSafeToReMat.
llvm-svn: 55563
2008-08-30 09:07:18 +00:00
Evan Cheng
cf2cb4da82 Move the check whether it's worth remating to caller.
llvm-svn: 55434
2008-08-27 20:58:54 +00:00
Evan Cheng
dc202f4bba Refactor isSafeToReMat out of 2addr pass.
llvm-svn: 55430
2008-08-27 20:33:50 +00:00
Chris Lattner
e5073632e2 simplify PseudoSourceValue printing a bit. Unnest all of PseudoSourceValue.cpp from the llvm namespace.
llvm-svn: 55293
2008-08-24 20:37:32 +00:00
Evan Cheng
19c915aa0e Print PseudoSourceValue.
llvm-svn: 55291
2008-08-24 18:51:20 +00:00
Dan Gohman
e1a5bc775e Change the FoldingSetNodeID usage for objects which carry
alignment and volatility information, such as loads and
stores, to reduce the number of integer values added to
the FoldingSetNodeID.

llvm-svn: 55058
2008-08-20 15:58:01 +00:00
Owen Anderson
fd1d9b5c38 Move MachineInstr::getOpcode inline.
llvm-svn: 54807
2008-08-14 23:25:30 +00:00
Owen Anderson
169e5e5b99 Speed up addRegisterDead by adding more fast checks before performing the expensive
subregister query, and by increasing the size of the subregister hashtable so
that there are fewer collisions.

llvm-svn: 54781
2008-08-14 18:34:18 +00:00
Dan Gohman
9653b21dc2 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.

llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Dan Gohman
8f718c75f0 Now that the MachineInstr leaks are fixed, enable leak checking
in the MachineInstr clone code.

llvm-svn: 53868
2008-07-21 18:47:29 +00:00
Evan Cheng
5ed6b9f0ae Fix a memory leak in LiveIntervalAnalysis.
llvm-svn: 53779
2008-07-19 00:37:25 +00:00
Dan Gohman
f38f99ccc5 Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
Fix a leak that this turned up in LowerSubregs.cpp.
And, comment a leak in LiveIntervalAnalysis.cpp.

llvm-svn: 53746
2008-07-17 23:49:46 +00:00
Dan Gohman
bc29205ccc Add an assert to check for empty flags for MachineMemOperand.
llvm-svn: 53680
2008-07-16 15:56:42 +00:00
Dan Gohman
d7a32ecde2 Trim unnecessary #includes.
llvm-svn: 53471
2008-07-11 20:38:31 +00:00
Evan Cheng
3ec3113431 - Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.

llvm-svn: 53394
2008-07-10 07:35:43 +00:00
Dan Gohman
9f1547684c It's no longer necessary to test if a MachineBasicBlock's
parent is non-null. It now always is.

llvm-svn: 53263
2008-07-08 23:59:09 +00:00
Dan Gohman
286e8f7295 Verify that MachineMemOperand alignment is a non-zero power of 2.
llvm-svn: 53262
2008-07-08 23:47:04 +00:00
Dan Gohman
cd25487258 Pool-allocation for MachineInstrs, MachineBasicBlocks, and
MachineMemOperands. The pools are owned by MachineFunctions.

This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.

llvm-svn: 53212
2008-07-07 23:14:23 +00:00
Dan Gohman
255eb1d296 Move MachineMemOperand's constructor out of line, to avoid a
#include dependency on Support/MathExtras.h in the header file.

llvm-svn: 53200
2008-07-07 20:32:02 +00:00
Evan Cheng
1f6148a84c - Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc.
- Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list.

llvm-svn: 53097
2008-07-03 09:09:37 +00:00
Dan Gohman
ca3abd7409 Reapply r52988, "Simplify addRegisterKilled and addRegisterDead." The
254.gap failure was not due to this mod.

llvm-svn: 53068
2008-07-03 01:18:51 +00:00
Dan Gohman
d9458e2d39 Revert r52988. It broke 254.gap on x86-64.
llvm-svn: 53050
2008-07-02 22:12:55 +00:00
Evan Cheng
508e82fcfc Simplify addRegisterKilled and addRegisterDead.
llvm-svn: 52988
2008-07-01 22:21:21 +00:00
Dan Gohman
c8097f8c8c Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.

llvm-svn: 52943
2008-07-01 00:05:16 +00:00
Evan Cheng
36adcb1eea Looks like this condition is inverted.
llvm-svn: 52841
2008-06-27 22:11:49 +00:00
Owen Anderson
242026fa70 Don't perform expensive queries checking for super and sub registers when we know that there aren't any.
This speed up LiveVariables on instcombine at -O0 -g from 0.3855s to 0.3503s.  Look for more improvements in this area soon!

llvm-svn: 52804
2008-06-27 01:22:50 +00:00
Bill Wendling
b56bc61cf4 Add a flag to indicate that an instruction is as cheap (or cheaper) than a move
instruction to execute. This can be used for transformations (like two-address
conversion) to remat an instruction instead of generating a "move"
instruction. The idea is to decrease the live ranges and register pressure and
all that jazz.

llvm-svn: 51660
2008-05-28 22:54:52 +00:00
Dan Gohman
f7f3f7ab8f Fix a broken doxygen comment, and reword it for clarity.
llvm-svn: 50687
2008-05-06 00:20:10 +00:00
Evan Cheng
b3c4319e64 Code clean up.
llvm-svn: 49783
2008-04-16 09:41:59 +00:00
Dan Gohman
d7301ea935 Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.

llvm-svn: 49348
2008-04-07 19:35:22 +00:00
Chris Lattner
6c4486c5c7 detabify llvm, patch by Mike Stump!
llvm-svn: 48577
2008-03-20 01:22:40 +00:00
Evan Cheng
b9fc5d6d07 Refactor some code out of MachineSink into a MachineInstr query.
llvm-svn: 48311
2008-03-13 00:44:09 +00:00
Evan Cheng
18064ddb5b Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.

llvm-svn: 47927
2008-03-05 00:59:57 +00:00
Bill Wendling
c1b2e17a2c Did I say 'e = getNumOperands()'? I meant --e, of course.
llvm-svn: 47875
2008-03-04 00:48:15 +00:00
Bill Wendling
aa5ca3b98d Miscellaneous clean-ups based on Evan's feedback:
- Cleaned up how the prologue-epilogue inserter loops over the instructions.
- Instead of restarting the processing of an instruction if we remove an
  implicit kill, just update the end iterator and make sure that the iterator
  isn't incremented.

llvm-svn: 47870
2008-03-03 23:57:28 +00:00
Bill Wendling
0f7bd2c0e5 Go through the machine instruction's operands to make sure that we're not
marking both a super- and sub-register as "killed". This removes implicit uses
that are marked as "killed".

llvm-svn: 47862
2008-03-03 22:14:33 +00:00
Bill Wendling
8fb166bf6c Rename PrintableName to Name.
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Bill Wendling
a369a6add8 Some platforms use the same name for 32-bit and 64-bit registers (like
%r3 on PPC) in their ASM files. However, it's hard for humans to read
during debugging. Adding a new field to the register data that lets you
specify a different name to be printed than the one that goes into the
ASM file -- %x3 instead of %r3, for instance.

llvm-svn: 47534
2008-02-24 00:56:13 +00:00
Nate Begeman
8352abdd98 Support a new type of MachineOperand, MO_FPImmediate, used for holding
FP Immediates, crazily enough

llvm-svn: 47117
2008-02-14 07:39:30 +00:00
Dan Gohman
cabaec582f Rename MRegisterInfo to TargetRegisterInfo.
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Evan Cheng
2d3d000878 Also print alignment.
llvm-svn: 46895
2008-02-08 22:05:07 +00:00
Dan Gohman
ebca101f50 Don't abort if a MemOperand is missing a SourceValue; just print it
as <unknown>. And make some minor adjustments to the MemOperand
dump format.

llvm-svn: 46853
2008-02-07 16:18:00 +00:00
Dan Gohman
f00842e086 Re-apply the memory operand changes, with a fix for the static
initializer problem, a minor tweak to the way the
DAGISelEmitter finds load/store nodes, and a renaming of the
new PseudoSourceValue objects.

llvm-svn: 46827
2008-02-06 22:27:42 +00:00
Evan Cheng
2a533e6894 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
705212577d 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
Dan Gohman
4326d513ab 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
Owen Anderson
4d78ff86ae Move some functionality for adding flags to MachineInstr's into methods on MachineInstr rather than LiveVariables.
llvm-svn: 46295
2008-01-24 01:10:07 +00:00
Chris Lattner
f4f5495b06 remove #includage
llvm-svn: 45697
2008-01-07 07:42:25 +00:00
Chris Lattner
f83aae613c 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
9b987de2c5 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
9d38dfa4a5 Move a bunch more accessors from TargetInstrInfo to TargetInstrDescriptor
llvm-svn: 45680
2008-01-07 03:13:06 +00:00
Chris Lattner
93e1e6ee12 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
f7f96d818f 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
fc976a38ff Make MachineRegisterInfo::getVRegDef more efficient by aiming the keep the def of the vreg at the start of the list, so the list doesn't need to be traversed.
llvm-svn: 45483
2008-01-01 21:08:22 +00:00
Chris Lattner
490a9681cb switch the register iterator to act more like hte LLVM value iterator: dereferencing
it now returns the machineinstr of the use.  To get the operand, use I.getOperand().

Add a new MachineRegisterInfo::replaceRegWith, which is basically like
Value::replaceAllUsesWith.

llvm-svn: 45482
2008-01-01 20:36:19 +00:00
Chris Lattner
39b56ec51b Implement automatically updated def/use lists for all MachineInstr register
operands.  The lists are currently kept in MachineRegisterInfo, but it does
not yet provide an iterator interface to them.

llvm-svn: 45477
2008-01-01 01:12:31 +00:00
Chris Lattner
d8b7ecd871 properly encapsulate the parent field of MBB and MI with get/set accessors.
llvm-svn: 45469
2007-12-31 04:56:33 +00:00
Chris Lattner
96167aa93c Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
that "machine" classes are used to represent the current state of
the code being compiled.  Given this expanded name, we can start 
moving other stuff into it.  For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.

Update all the clients to match.

This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.

llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Chris Lattner
9e5cc35593 Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock().  I don't plan on 
switching everything over, so new clients should just start using the 
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(), 
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.

llvm-svn: 45464
2007-12-30 23:10:15 +00:00
Chris Lattner
7504adbd72 More cleanups for MachineOperand:
- Eliminate the static "print" method for operands, moving it
    into MachineOperand::print.
  - Change various set* methods for register flags to take a bool
    for the value to set it to.  Remove unset* methods.
  - Group methods more logically by operand flavor in MachineOperand.h

llvm-svn: 45461
2007-12-30 21:56:09 +00:00
Chris Lattner
7d47b6c164 MachineOperand:
- Add getParent() accessors.
  - Move SubReg out of the AuxInfo union, to make way for future changes.
  - Remove the getImmedValue/setImmedValue methods.
  - in some MachineOperand::Create* methods, stop initializing fields that are dead.

MachineInstr:
  - Delete one copy of the MachineInstr printing code, now there is only one dump
    format and one copy of the code.
  - Make MachineOperand use the parent field to get info about preg register names if
    no target info is otherwise available.
  - Move def/use/kill/dead flag printing to the machineoperand printer, so they are
    always printed for an operand.

llvm-svn: 45460
2007-12-30 21:31:53 +00:00
Chris Lattner
31932a7542 simpilfy some register printing code.
llvm-svn: 45458
2007-12-30 21:08:36 +00:00
Chris Lattner
46e4658c95 eliminate a copy of the machineoperand printing stuff. Keep the copy that
knows how to print offsets.

llvm-svn: 45457
2007-12-30 21:03:30 +00:00
Chris Lattner
ff61fe680e Simplify and clean up some machine operand/instr printing/dumping stuff.
llvm-svn: 45456
2007-12-30 21:01:27 +00:00
Chris Lattner
98c3fabf47 two register machineoperands are not identical unless their subregs match.
llvm-svn: 45455
2007-12-30 20:55:08 +00:00
Chris Lattner
4a4943a78f MachineOperand::getImmedValue -> MachineOperand::getImm
llvm-svn: 45454
2007-12-30 20:50:28 +00:00
Chris Lattner
d6051f028d make machine operands fatter: give each one an up-pointer to the
machineinstr that owns it.

llvm-svn: 45449
2007-12-30 06:11:04 +00:00
Chris Lattner
19dd6c4eac Start using the simplified methods for adding operands.
llvm-svn: 45432
2007-12-30 00:41:17 +00:00
Chris Lattner
e868c77f16 simplify some code by factoring operand construction better.
llvm-svn: 45428
2007-12-30 00:12:25 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Evan Cheng
fd33cb316f Clean up sub-register implementation by moving subReg information back to
MachineOperand auxInfo. Previous clunky implementation uses an external map
to track sub-register uses. That works because register allocator uses
a new virtual register for each spilled use. With interval splitting (coming
soon), we may have multiple uses of the same register some of which are
of using different sub-registers from others. It's too fragile to constantly
update the information.

llvm-svn: 44104
2007-11-14 07:59:08 +00:00
Evan Cheng
2262b2a792 Optionally create a MachineInstr without default implicit operands.
llvm-svn: 42945
2007-10-13 02:23:01 +00:00
Evan Cheng
d11cd4a095 EXTRACT_SUBREG coalescing support. The coalescer now treats EXTRACT_SUBREG like
(almost) a register copy. However, it always coalesced to the register of the
RHS (the super-register). All uses of the result of a EXTRACT_SUBREG are sub-
register uses which adds subtle complications to load folding, spiller rewrite,
etc.

llvm-svn: 42899
2007-10-12 08:50:34 +00:00
Dan Gohman
fb60c0dfed Remove isReg, isImm, and isMBB, and change all their users to use
isRegister, isImmediate, and isMachineBasicBlock, which are equivalent,
and more popular.

llvm-svn: 41958
2007-09-14 20:33:02 +00:00
Dan Gohman
53119779c2 Remove spurious consts. This fixes warnings with compilers that
are strict about such things.

llvm-svn: 41956
2007-09-14 20:08:19 +00:00
Christopher Lamb
cb63a77a51 Remove subreg index from MachineInstr's and also keep vregs as unsigned when adding operands.
llvm-svn: 40514
2007-07-26 07:00:46 +00:00
Evan Cheng
88c463eb8c MachineInstr::isPredicable() is no longer needed.
llvm-svn: 37599
2007-06-15 19:06:07 +00:00
Evan Cheng
d8b25a2091 Add missing const qualifiers.
llvm-svn: 37341
2007-05-29 18:35:22 +00:00
Evan Cheng
6f761adecb Rename M_PREDICATED to M_PREDICABLE; Moved isPredicable() to MachineInstr.
llvm-svn: 37121
2007-05-16 20:56:08 +00:00
Evan Cheng
eea85a767e Added getNumExplicitOperands and findFirstPredOperand.
llvm-svn: 37064
2007-05-15 01:26:09 +00:00
Nate Begeman
767ee95d29 llvm bug #1350, parts 1, 2, and 3.
llvm-svn: 36618
2007-05-01 05:57:02 +00:00
Evan Cheng
eff332e3e1 Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.
llvm-svn: 36483
2007-04-26 19:00:32 +00:00
Evan Cheng
201771637e Change findRegisterUseOperand() to return operand index instead.
llvm-svn: 35363
2007-03-26 22:37:45 +00:00
Evan Cheng
387f1c2bdf Use findRegisterUseOperand to find a kill of particular register.
llvm-svn: 34512
2007-02-23 01:04:26 +00:00
Evan Cheng
e4ab9c032b Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
llvm-svn: 34428
2007-02-19 21:49:54 +00:00
Reid Spencer
b27fcf3482 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
35f59a6dd2 Added findRegisterDefOperand().
llvm-svn: 34380
2007-02-17 11:10:18 +00:00
Evan Cheng
5b8b96e9de Print <dead> def operands.
llvm-svn: 34343
2007-02-16 09:49:18 +00:00
Jeff Cohen
c396e18e8e The best unbreakage yet, addressing Bill's concerns.
llvm-svn: 32622
2006-12-16 02:15:42 +00:00
Jeff Cohen
03161dd132 An even better unbreakage...
llvm-svn: 32617
2006-12-15 22:57:14 +00:00
Bill Wendling
a3246c4272 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Evan Cheng
59494f9e3d Move copyKillDeadInfo out-of-line. Add findRegisterUseOperand().
llvm-svn: 32273
2006-12-06 08:27:42 +00:00
Evan Cheng
cb65ba1821 - MachineInstr now keeps a ptr to TargetInstrDescriptor instead of Opcode.
- Remove the ugly TargetInstrDescriptors hack.

llvm-svn: 32032
2006-11-30 07:08:44 +00:00
Bill Wendling
d8c0883f20 Use llvm streams instead of <iostream>
llvm-svn: 31985
2006-11-28 22:48:48 +00:00
Evan Cheng
e176869ec0 Clean up.
llvm-svn: 31957
2006-11-28 02:25:34 +00:00
Evan Cheng
98fa7ab4d7 Change MachineInstr ctor's to take a TargetInstrDescriptor reference instead
of opcode and number of operands.

llvm-svn: 31947
2006-11-27 23:37:22 +00:00
Chris Lattner
31f45746ad setOperand should not zap the operand list or add implicit operands to an
instruction.  Doing so breaks the FP stackifier, the alpha branch selector
the sparc fpmover.

This fixes PR1012 and CodeGen/X86/fp-stack-compare.ll

llvm-svn: 31876
2006-11-20 17:57:22 +00:00
Evan Cheng
cf45b9fa95 Minor updates.
llvm-svn: 31761
2006-11-15 20:54:29 +00:00
Evan Cheng
7cabf9d02c - Let MachineInstr ctors add implicit def and use operands. Other operands
will be inserted before these operands. If the opcode changes (by
  setOpcode), the implicit operands are updated as well.
- Added IsKill, IsDead fields to MachineOperand in preparation for changes
  that move kill / dead info to MachineInstr's.

llvm-svn: 31711
2006-11-13 23:34:06 +00:00
Evan Cheng
7dab9abfb8 Add methods to add implicit def use operands to a MI.
llvm-svn: 31675
2006-11-11 10:20:02 +00:00
Evan Cheng
013597778d Add implicit def / use operands to MachineInstr.
llvm-svn: 31633
2006-11-10 08:43:01 +00:00
Chris Lattner
5bb7f41bca be more aggressive about matching identical instructions.
llvm-svn: 31179
2006-10-25 18:08:14 +00:00
Chris Lattner
cf4137d0b9 implement MachineOperand::isIdenticalTo
llvm-svn: 31088
2006-10-20 22:39:59 +00:00
Chris Lattner
0fad1515ee Only call isUse/isDef on register operands
llvm-svn: 30118
2006-09-05 20:19:27 +00:00
Evan Cheng
07d8ccec50 Instructions with variable operands (variable_ops) can have a number required
operands. e.g.
def CALL32r : I<0xFF, MRM2r, (ops GR32:$dst, variable_ops),
                "call {*}$dst", [(X86call GR32:$dst)]>;
TableGen should emit operand informations for the "required" operands.

Added a target instruction info flag M_VARIABLE_OPS to indicate the target
instruction may have more operands in addition to the minimum required
operands.

llvm-svn: 28791
2006-06-15 07:22:16 +00:00
Evan Cheng
328b47bc28 Remove a bogus cast.
llvm-svn: 28492
2006-05-26 08:00:14 +00:00
Chris Lattner
db888e7880 Final pass of minor cleanups for MachineInstr
llvm-svn: 28110
2006-05-04 19:36:09 +00:00
Chris Lattner
32adc4592f Remove redundancy and a level of indirection when creating machine operands
llvm-svn: 28107
2006-05-04 19:14:44 +00:00
Chris Lattner
075404adaa Remove and simplify some more machineinstr/machineoperand stuff.
llvm-svn: 28105
2006-05-04 18:16:01 +00:00
Chris Lattner
eb41c99161 Rename MO_VirtualRegister -> MO_Register. Clean up immediate handling.
llvm-svn: 28104
2006-05-04 18:05:43 +00:00
Chris Lattner
685568510a Move some methods out of MachineInstr into MachineOperand
llvm-svn: 28102
2006-05-04 17:52:23 +00:00
Chris Lattner
97f1af2f14 There shalt be only one "immediate" operand type!
llvm-svn: 28099
2006-05-04 17:21:20 +00:00
Chris Lattner
51b0cac238 Change "value" in MachineOperand to be a GlobalValue, as that is the only
thing that can be in it.  Remove a dead method.

llvm-svn: 28098
2006-05-04 17:02:51 +00:00
Chris Lattner
a39a7f900f Remove a bunch more dead V9 specific stuff
llvm-svn: 28094
2006-05-04 01:26:39 +00:00
Chris Lattner
c779fca289 Remove a bunch more SparcV9 specific stuff
llvm-svn: 28093
2006-05-04 01:15:02 +00:00
Chris Lattner
ed58ec2a57 Remove some more V9-specific stuff.
llvm-svn: 28092
2006-05-04 00:49:59 +00:00
Chris Lattner
0f89e6b11d Remove some more unused stuff from MachineInstr that was leftover from V9.
llvm-svn: 28091
2006-05-04 00:44:25 +00:00
Nate Begeman
7ed816f900 JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.

llvm-svn: 27947
2006-04-22 18:53:45 +00:00
Chris Lattner
04a8496ef0 This field no longer exists
llvm-svn: 27899
2006-04-20 18:32:41 +00:00
Chris Lattner
a6a6ac15af Remove some of the obvious V9-specific cruft
llvm-svn: 27893
2006-04-20 18:08:53 +00:00
Chris Lattner
5f5a9cc8ea Add a MachineInstr::eraseFromParent convenience method.
llvm-svn: 27775
2006-04-17 21:35:41 +00:00
Misha Brukman
774e55c446 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Chris Lattner
65976f4178 Allow machine operands to represent global variables with offsets. This is
useful when you have a reference like:

int A[100];

void foo() { A[10] = 1; }

In this case, &A[10] is a single constant and should be treated as such.

Only MO_GlobalAddress and MO_ExternalSymbol are allowed to use this field, no
other operand type is.

This is another fine patch contributed by Jeff Cohen!!

llvm-svn: 17007
2004-10-15 04:38:41 +00:00
Reid Spencer
c4abcbefb1 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
Misha Brukman
abbe59490b * Doxygenify comments
* Fix spacing, grammar in comment
* Make code layout consistent
* Wrap code at 80 cols
* Delete spurious blank lines

No functional changes.

llvm-svn: 14721
2004-07-09 14:45:17 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Tanya Lattner
da38dc5180 Made a fix so that you can print out MachineInstrs that belong to a MachineBasicBlock that is not yet attached to a MachineFunction. This change includes changing the third operand (TargetMachine) to a pointer for the MachineInstr::print function.
llvm-svn: 14389
2004-06-25 00:13:11 +00:00
Brian Gaeke
6f6eb93de3 Make debugging dumps w/ multiple MachineBBs for a given LLVM BB readable.
llvm-svn: 14205
2004-06-17 22:26:53 +00:00
Chris Lattner
0046ea7105 Adjust to new TargetMachine interface
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Tanya Lattner
55477a5af1 Changed clone to be const.
Changed copy constructor to set parent, prev, and next pointers to null.

llvm-svn: 13706
2004-05-24 03:14:18 +00:00
Tanya Lattner
e755fc6689 Fixed up my changes to add support for cloning Machine Instructions.
llvm-svn: 13665
2004-05-23 20:58:02 +00:00
Tanya Lattner
2848065a29 Adding support to clone MachineInstr
llvm-svn: 13661
2004-05-23 19:35:12 +00:00
Brian Gaeke
aa96ff7926 Make MachineOperand's value named 'contents'. Make really, really sure
it is always completely initialized and copied.
Also, fix up many comments and asserts.

llvm-svn: 12100
2004-03-03 19:07:27 +00:00
Chris Lattner
8b7ac81d2e int64_t -> int
llvm-svn: 11977
2004-02-29 05:07:02 +00:00
Alkis Evlogimenos
3093de5bfb Fix crash caused by passing register 0 to
MRegisterInfo::isPhysicalRegister().

llvm-svn: 11894
2004-02-27 01:52:34 +00:00
Chris Lattner
82e1a3657d Fix bugs in finegrainification
llvm-svn: 11758
2004-02-23 18:40:08 +00:00
Chris Lattner
1bf9dde4a1 Finegrainify namespacification
llvm-svn: 11757
2004-02-23 18:38:20 +00:00
Chris Lattner
8a9be6b652 Fix a __LONG__ term annoyance of mine: symbolic registers weren't being printed
by operator<< on MachineInstr's, and looking up what register "24" is all of the
time was greatly annoying.

llvm-svn: 11623
2004-02-19 16:17:08 +00:00
Alkis Evlogimenos
790b000aa7 Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.

llvm-svn: 11497
2004-02-16 07:17:43 +00:00
Alkis Evlogimenos
6d6ab846af Remove getAllocatedRegNum(). Use getReg() instead.
llvm-svn: 11393
2004-02-13 21:01:20 +00:00
Brian Gaeke
44cc73b6f2 Add head-of-file comments and Doxygen comments. Tighten up a lot of whitespace.
Rename SetMachineOperandConst's formal parameters to match other methods here.
Mark some methods as being used only by the SPARC back-end.
Fix a missing-paren bug in OutputValue().

llvm-svn: 11363
2004-02-13 04:39:32 +00:00
Alkis Evlogimenos
3ecdcd18c5 Add parent pointer to MachineInstr that points to owning
MachineBasicBlock. Also change opcode to a short and numImplicitRefs
to an unsigned char so that overall MachineInstr's size stays the
same.

llvm-svn: 11357
2004-02-12 18:49:07 +00:00
Chris Lattner
ef375052c6 Rename the opCode instance variable to Opcode
llvm-svn: 11348
2004-02-12 16:09:53 +00:00
Chris Lattner
bda81f88b7 This field is never read
llvm-svn: 11346
2004-02-12 16:04:49 +00:00
Alkis Evlogimenos
676e5b8997 Modify the two address instruction pass to remove the duplicate
operand of the instruction and thus simplify the register allocation.

llvm-svn: 11124
2004-02-04 22:17:40 +00:00
Alkis Evlogimenos
5e78d4bd75 When an instruction like: A += B had both A and B virtual registers
spilled, A was loaded from its stack location twice. This fixes the bug.

llvm-svn: 11093
2004-02-03 01:13:07 +00:00
Alkis Evlogimenos
29127b8825 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
Brian Gaeke
d25f86d683 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
b402729b30 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
Misha Brukman
9708959677 Fixed spelling.
llvm-svn: 8588
2003-09-17 21:34:23 +00:00
Vikram S. Adve
bc05294ada Fix assertion in MachineInstr::substituteValue().
llvm-svn: 7675
2003-08-07 15:01:48 +00:00
Chris Lattner
a826c8d485 Do not insert physical regsiters into the regsUsed set
llvm-svn: 7617
2003-08-05 21:55:20 +00:00
Chris Lattner
b047a0d449 All callers of these methods actually wanted them to preserve the flags,
so get rid of the def/use parameters that were getting passed in.

**** This now changes the semantics of these methods to preserve the flags,
     not clobber them!

llvm-svn: 7602
2003-08-05 16:58:46 +00:00
Chris Lattner
5dca2ea4bc Simplify code, eliminating the need for the X86 isVoid target instr flag
llvm-svn: 7534
2003-08-03 21:51:45 +00:00
Chris Lattner
eba995d624 Remove using decl
llvm-svn: 7531
2003-08-03 20:24:29 +00:00
Vikram S. Adve
6aa3abf7fa Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.

llvm-svn: 7154
2003-07-10 19:45:07 +00:00
Vikram S. Adve
b2bb0dd8ca Allow explicit physical registers for implicit operands.
llvm-svn: 6468
2003-05-31 07:39:06 +00:00
Vikram S. Adve
681b3c77fa (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
cfa7a8f9a2 Remove obsolete ctor
llvm-svn: 5301
2003-01-15 19:47:02 +00:00
Chris Lattner
b27d60ccf1 Rename MachineInstrInfo -> TargetInstrInfo
llvm-svn: 5272
2003-01-14 22:00:31 +00:00
Chris Lattner
acef9340fe Add support for 3 new forms of MachineOperand
llvm-svn: 5217
2003-01-13 00:23:24 +00:00
Chris Lattner
831939c09a * Add printing support for FrameIndex operands
llvm-svn: 5194
2002-12-28 20:37:37 +00:00
Chris Lattner
dd307412c4 Implement printing of MBB arguments
llvm-svn: 5053
2002-12-15 20:35:25 +00:00
Chris Lattner
3afc487fba Print is const!
llvm-svn: 4737
2002-11-17 23:22:13 +00:00
Chris Lattner
8ac4eea84b Remove only uses of markDef/markDefAndUse methods
llvm-svn: 4719
2002-11-17 22:14:08 +00:00
Chris Lattner
8fa0840abd Remove fixme
llvm-svn: 4447
2002-10-30 02:02:37 +00:00
Chris Lattner
98e6bad1ee Add special code to make printing SSA form machine instructions nicer
llvm-svn: 4446
2002-10-30 01:55:38 +00:00
Chris Lattner
8dfb0ef7b0 Use MRegisterInfo, if available, to print symbolic register names
llvm-svn: 4438
2002-10-30 00:58:19 +00:00
Chris Lattner
2cfa08e4bf Implement structured machine code printing
llvm-svn: 4435
2002-10-30 00:48:05 +00:00
Chris Lattner
64fa3f3e97 Implement autoinserting ctor
llvm-svn: 4426
2002-10-29 23:19:00 +00:00
Vikram S. Adve
4acb69b4ea Remove separate vector of implicit refs from MachineInstr, and
instead record them as extra operands in the operands[] vector.
Also, move CallArgsDescriptor into this class instead of making it an
annotation on the machine instruction.

llvm-svn: 4399
2002-10-29 19:41:18 +00:00
Chris Lattner
b49e35e745 Move TargetInstrDescriptors extern to the one .cpp file that refers to it:
MachineInstr.cpp

llvm-svn: 4392
2002-10-29 17:40:30 +00:00
Chris Lattner
fa303f1bb7 Use higher level methods, don't use TargetInstrDescriptors directly!
llvm-svn: 4389
2002-10-29 17:35:39 +00:00
Chris Lattner
566b2147f9 Remove all traces of the "Opcode Mask" field in the MachineInstr class
llvm-svn: 4359
2002-10-28 21:17:20 +00:00
Chris Lattner
11f52470a0 Remove more default arguments that are never used
llvm-svn: 4358
2002-10-28 21:02:40 +00:00
Chris Lattner
990e074c2e Remove default operands that are never used
llvm-svn: 4357
2002-10-28 20:59:49 +00:00
Chris Lattner
de6ac9b0ff * Make MachineOperand ctors private, so MachineOperand can only be created
by MachineInstr.
* Add a bunch of new methods to allow incremental addition of operands to the
  machine instr instance.

llvm-svn: 4356
2002-10-28 20:48:39 +00:00
Chris Lattner
74f9160190 Remove two arguments that are never specified
llvm-svn: 4348
2002-10-28 19:46:59 +00:00
Chris Lattner
7000bbb63f Fairly major overhaul of MachineInstr & Operand classes
- Inline methods that are mostly a single line anyway
  - Eliminate several methods that were never called
  - Group methods a bit more consistently

llvm-svn: 4329
2002-10-28 04:24:49 +00:00
Chris Lattner
dd22b9e8b6 Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h
llvm-svn: 4327
2002-10-28 02:28:39 +00:00
Chris Lattner
dfc8fbf16b - Two minor improvements to the MachineInstr class to reduce footprint and
overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a
    bitvector.  Sped up LLC a little less than 10% in a debug build!

llvm-svn: 4261
2002-10-22 23:16:21 +00:00
Vikram S. Adve
47303cde2d Add method MachineInstr::replace to rewrite a machine instruction in place.
llvm-svn: 3843
2002-09-20 00:47:49 +00:00
Vikram S. Adve
3d9c3e8751 Dump routine now writes out allocated register numbers if available.
llvm-svn: 3737
2002-09-16 15:18:53 +00:00
Vikram S. Adve
87928f2098 Add method MachineInstr::substituteValue() which substitutes
one Value with another one in all operands and implicit references
of the machine instruction.

llvm-svn: 3306
2002-08-14 16:52:58 +00:00
Chris Lattner
8a4787495a * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes

llvm-svn: 3278
2002-08-09 20:08:06 +00:00
Chris Lattner
05fe67c0d2 *** empty log message ***
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Vikram S. Adve
62f569e4ea Add support for marking each operand as a %hh, %hm, %lm or %lo.
Represent previous bools and these ones with flags in a single byte
per operand.

llvm-svn: 2860
2002-07-10 21:45:04 +00:00
Vikram S. Adve
a110ccca19 Moved class MachineCodeForBasicBlock to MachineCodeForBasicBlock.{cpp,h}.
An (explicit or implicit) operand may now be both a def and a use.
Also add a set of regs used by each instruction.
dump() no longer takes an optional argument, which doesn't work in gdb.

llvm-svn: 2821
2002-07-08 22:38:45 +00:00
Vikram S. Adve
ad382a01be Improve printing during dumps.
llvm-svn: 2311
2002-04-25 04:31:18 +00:00
Chris Lattner
cd3575a5cf s/method/function
llvm-svn: 2177
2002-04-08 22:01:15 +00:00
Vikram S. Adve
edc1adae11 Bug fix in setting CC register.
Also use distinct names for the three types of SetMachineOperand
to avoid painful overloading problems and errors.

llvm-svn: 1904
2002-03-18 03:35:24 +00:00
Chris Lattner
b8b17dc6dc * Prune #includes
* Remove MachineCodeFor(Method|VMInstr) code to their own .cpp files

llvm-svn: 1649
2002-02-03 07:46:01 +00:00
Chris Lattner
3dc9a2a61f Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
c4a5815033 Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator   -> const_op_iterator
Renamed PointerType::getValueType() -> PointerType::getElementType()

llvm-svn: 1408
2001-12-04 00:03:30 +00:00
Ruchira Sasanka
647337ad60 Added naming to inserted phi copy values - for easy debugging
llvm-svn: 1325
2001-11-15 20:46:40 +00:00
Vikram S. Adve
bcd2ba2fea Modify AllocateLocalVar method to take a size argument.
llvm-svn: 1318
2001-11-15 15:22:26 +00:00
Ruchira Sasanka
7b4fe5d51b Small changed to printing a machine operand - It the operand is a def, it prints
a star after it - only for debugging

llvm-svn: 1309
2001-11-14 20:05:23 +00:00
Vikram S. Adve
0bd498dd38 Bug fix in offset alignment computations: don't subtract the padding
value from size *before* subtracting size from offset!

llvm-svn: 1283
2001-11-12 23:26:23 +00:00
Vikram S. Adve
1fc185b8e7 Improved printing routines.
llvm-svn: 1263
2001-11-12 14:19:47 +00:00
Vikram S. Adve
31372d2b26 Adjust all stack variable offsets to be aligned by size.
llvm-svn: 1261
2001-11-12 05:17:23 +00:00
Vikram S. Adve
51265e7072 Fix errors in computing downgrowing offsets, and in
computing size of extra outgoing args.

llvm-svn: 1256
2001-11-11 21:23:33 +00:00
Vikram S. Adve
2cdcbfb6e0 Major overhaul of stack frame management.
llvm-svn: 1185
2001-11-08 04:47:06 +00:00
Vikram S. Adve
24fbd417a0 Make reg. numbers signed ints.
llvm-svn: 1137
2001-11-05 03:56:02 +00:00
Vikram S. Adve
c63a39ae14 Added class MachineCodeForMethod.
llvm-svn: 947
2001-10-22 13:51:33 +00:00
Ruchira Sasanka
33e147a7d0 Added implict operand printing for operator( ostream, MachineInstr&)
llvm-svn: 912
2001-10-18 22:40:02 +00:00
Vikram S. Adve
34b17e8a37 1. Add a bottom-up pass on BURG trees that is used to fix constant operands.
Needs to be bottom up because constant values may be forward-substituted
   to their uses (i.e., into the parent in the BURG tree).
2. Move most of the constant-fixup code into machine-indepedent file
   InstrSelectionSupport.cpp.

llvm-svn: 859
2001-10-17 23:57:50 +00:00
Vikram S. Adve
34c44524a7 Moved code generation support routines to InstrSelectionSupport.cpp.
llvm-svn: 717
2001-10-10 20:49:07 +00:00
Chris Lattner
ad1b0a1a83 Convert more code to use new style casts
Eliminate old style casts from value.h

llvm-svn: 696
2001-10-01 20:11:19 +00:00
Vikram S. Adve
7b68e7247a Improved dump for disp type operand.
llvm-svn: 679
2001-09-30 23:44:19 +00:00
Vikram S. Adve
296070fa2c Minor changes.
llvm-svn: 613
2001-09-18 12:56:28 +00:00
Ruchira Sasanka
3706ce9f36 added setRegForValue to MachineOperand class
llvm-svn: 591
2001-09-15 19:07:45 +00:00
Chris Lattner
70439801a6 Eliminate MainTreeNode function
llvm-svn: 550
2001-09-11 23:22:43 +00:00