Commit Graph

97 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
c8ce7a4bb5 Add an MIBundleBuilder class.
Like the MachineInstrBuilder, this class makes it easier to build
bundles of MachineInstrs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-07 04:23:35 +00:00
Evan Cheng
a395f4df5b Change MachineInstrBuilder::addDisp to copy over target flags by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165677 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 00:15:48 +00:00
Jakob Stoklund Olesen
0b40d09ff6 Add a new kind of MachineOperand: MO_TargetIndex.
A target index operand looks a lot like a constant pool reference, but
it is completely target-defined. It contains the 8-bit TargetFlags, a
32-bit index, and a 64-bit offset. It is preserved by all code generator
passes.

TargetIndex operands can be used to carry target-specific information in
cases where immediate operands won't suffice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:56:39 +00:00
Pete Cooper
4efea94fa5 Add internal read flags to MachineInstrBuilder and hook them into the MachineOperand flag of the same name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-07 04:43:52 +00:00
Jakob Stoklund Olesen
fce711cb65 Use <def,undef> operands when spilling NEON bundles.
MachineOperands that define part of a virtual register must have an
<undef> flag if they are not intended as read-modify-write operands.

The old trick of adding an <imp-def> operand doesn't work any longer.

Fixes PR12177.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152008 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-04 18:40:30 +00:00
Jakob Stoklund Olesen
7739cad69d Add a new kind of MachineOperand: MO_RegisterMask.
Register masks will be used as a compact representation of large clobber
lists.  Currently, an x86 call instruction has some 40 operands
representing call-clobbered registers.  That's more than 1kB of useless
operands per call site.

A register mask operand references a bit mask of call-preserved
registers, everything else is clobbered.  The bit mask will typically
come from TargetRegisterInfo::getCallPreservedMask().

By abandoning ImplicitDefs for call-clobbered registers, it also becomes
possible to share call instruction descriptions between calling
conventions, and we can get rid of the WINCALL* instructions.

This patch introduces the new operand kind.  Future patches will add
RegMask support to target-independent passes before finally the fixed
clobber lists can be removed from call instruction descriptions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148250 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-16 19:22:00 +00:00
Evan Cheng
ddfd1377d2 - Add MachineInstrBundle.h and MachineInstrBundle.cpp. This includes a function
to finalize MI bundles (i.e. add BUNDLE instruction and computing register def
  and use lists of the BUNDLE instruction) and a pass to unpack bundles.
- Teach more of MachineBasic and MachineInstr methods to be bundle aware.
- Switch Thumb2 IT block to MI bundles and delete the hazard recognizer hack to
  prevent IT blocks from being broken apart.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146542 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-14 02:11:42 +00:00
Evan Cheng
e837dead3c - Rename TargetInstrDesc, TargetOperandInfo to MCInstrDesc and MCOperandInfo and
sink them into MC layer.
- Added MCInstrInfo, which captures the tablegen generated static data. Chang
TargetInstrInfo so it's based off MCInstrInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134021 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 19:10:37 +00:00
Devang Patel
8594d429e0 Handle debug info for i128 constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133821 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 20:46:11 +00:00
Jim Grosbach
7fcbfe38d2 Frame indices are signed. Update MachineOperand methods accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 18:29:21 +00:00
Chris Lattner
07e7998f09 add a missing operator that caused us to have to use (*MIB).foo everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130473 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 05:24:07 +00:00
Anton Korobeynikov
94c1b08033 Provide hooks to set MI flags in MachineInstrBuilder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127100 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:43:20 +00:00
Dan Gohman
320afb8c81 Initial va_arg support for x86-64. Patch by David Meyer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-12 18:00:49 +00:00
Dan Gohman
46510a73e9 Add const qualifiers to CodeGen's use of LLVM IR constructs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101334 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 01:51:59 +00:00
Chris Lattner
3889fac428 add builder support for mcsymbol operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 08:16:25 +00:00
Dale Johannesen
91c38417cf Further constify MDNode* references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 19:39:56 +00:00
Dale Johannesen
a65aa0f0bb Add a Debug bit to MachineOperand, for uses that
are from debug info.  Add an iterator to MachineRegisterInfo
to skip Debug operands when walking the use list.  No
functional change yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 02:28:32 +00:00
Dale Johannesen
5f72a5ebc8 Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:00:24 +00:00
Devang Patel
c24096559d Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 00:39:25 +00:00
Dan Gohman
c76909abfe Improve MachineMemOperand handling.
- Allocate MachineMemOperands and MachineMemOperand lists in MachineFunctions.
   This eliminates MachineInstr's std::list member and allows the data to be
   created by isel and live for the remainder of codegen, avoiding a lot of
   copying and unnecessary translation. This also shrinks MemSDNode.
 - Delete MemOperandSDNode. Introduce MachineSDNode which has dedicated
   fields for MachineMemOperands.
 - Change MemSDNode to have a MachineMemOperand member instead of its own
   fields with the same information. This introduces some redundancy, but
   it's more consistent with what MachineInstr will eventually want.
 - Ignore alignment when searching for redundant loads for CSE, but remember
   the greatest alignment.

Target-specific code which previously used MemOperandSDNodes with generic
SDNodes now use MemIntrinsicSDNodes, with opcodes in a designated range
so that the SelectionDAG framework knows that MachineMemOperand information
is available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 20:36:54 +00:00
Daniel Dunbar
65b660743c A few more tabs -> spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 04:03:25 +00:00
Daniel Dunbar
31e2c7b4c1 Remove Offset from ExternalSybmol MachineOperands, this is unused (and at least partly unsupported, in X86 encoding at least).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 22:06:46 +00:00
Chris Lattner
f9dc699c42 add default ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 06:44:01 +00:00
Devang Patel
6d9148ce3d Add machine operand for MDNodes. This will be used to communicate debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:08:07 +00:00
Evan Cheng
4784f1fc73 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 08:49:04 +00:00
Chris Lattner
b1fb84dee9 just eliminate the code entirely!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 17:28:07 +00:00
Chris Lattner
d5899793a6 Clone target flags when copying mbb operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 17:21:32 +00:00
Sanjiv Gupta
8ebd4b6422 Identify unconditional gotos and generate a page sel instructions before them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 11:03:14 +00:00
Chris Lattner
9a96c425db ad MachineInstrBuilder support for target flags on operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 01:16:22 +00:00
Bill Wendling
587daedce2 Change MachineInstrBuilder::addReg() to take a flag instead of a list of
booleans. This gives a better indication of what the "addReg()" is
doing. Remembering what all of those booleans mean isn't easy, especially if you
aren't spending all of your time in that code.

I took Jakob's suggestion and made it illegal to pass in "true" for the
flag. This should hopefully prevent any unintended misuse of this (by reverting
to the old way of using addReg()).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13 21:33:08 +00:00
Dan Gohman
97357614b5 Factor out the code to add a MachineOperand to a MachineInstrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 05:45:50 +00:00
Dale Johannesen
a200c8faf8 Remove non-DebugLoc versions of BuildMI.
"I got blisters on my fingers."



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64439 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 02:35:20 +00:00
Dale Johannesen
21b5541814 Eliminate a couple of non-DebugLoc BuildMI variants.
Modify callers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 23:08:38 +00:00
Bill Wendling
9bc96a5720 Create DebugLoc information in FastISel. Several temporary methods were
created. Specifically, those BuildMIs which use
"DebugLoc::getUnknownLoc()". I'll remove them soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 00:55:04 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Dan Gohman
8cf7713753 Extend X86's addFrameReference to add a MachineMemOperand for
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:11:40 +00:00
Dan Gohman
6520e20e4f Teach DAGCombine to fold constant offsets into GlobalAddress nodes,
and add a TargetLowering hook for it to use to determine when this
is legal (i.e. not in PIC mode, etc.)

This allows instruction selection to emit folded constant offsets
in more cases, such as the included testcase, eliminating the need
for explicit arithmetic instructions.

This eliminates the need for the C++ code in X86ISelDAGToDAG.cpp
that attempted to achieve the same effect, but wasn't as effective.

Also, fix handling of offsets in GlobalAddressSDNodes in several
places, including changing GlobalAddressSDNode's offset from
int to int64_t.

The Mips, Alpha, Sparc, and CellSPU targets appear to be
unaware of GlobalAddress offsets currently, so set the hook to
false on those targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 02:06:02 +00:00
Dan Gohman
4fbd796a12 Change ConstantSDNode and ConstantFPSDNode to use ConstantInt* and
ConstantFP* instead of APInt and APFloat directly.

This reduces the amount of time to create ConstantSDNode
and ConstantFPSDNode nodes when ConstantInt* and ConstantFP*
respectively are already available, as is the case in
SelectionDAGBuild.cpp. Also, it reduces the amount of time
to legalize constants into constant pools, and the amount of
time to add ConstantFP operands to MachineInstrs, due to
eliminating ConstantInt::get and ConstantFP::get calls.

It increases the amount of work needed to create new constants
in cases where the client doesn't already have a ConstantInt*
or ConstantFP*, such as legalize expanding 64-bit integer constants
to 32-bit constants. And it adds a layer of indirection for the
accessor methods. But these appear to be outweight by the benefits
in most cases.

It will also make it easier to make ConstantSDNode and
ConstantFPNode more consistent with ConstantInt and ConstantFP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 18:08:03 +00:00
Dan Gohman
4b6e7069c3 Add a MachineInstrBuilder method for adding floating-point
immediate operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 23:19:23 +00:00
Dan Gohman
8e5f2c6f65 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 23:14:23 +00:00
Dan Gohman
36b5c1338a Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 19:35:22 +00:00
Evan Cheng
f8e43be758 Back out r48353. Not needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 22:01:01 +00:00
Evan Cheng
15fda403f3 Add an MO_Undef MachineOperandType, intended for INSERT_SUBREG. Next up MO_Undead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 01:47:49 +00:00
Dan Gohman
69de1932b3 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 22:27:42 +00:00
Evan Cheng
334dc1f58d Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 21:00:00 +00:00
Dan Gohman
c6c391dadd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 00:25:39 +00:00
Chris Lattner
749c6f6b5e rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 07:27:27 +00:00
Chris Lattner
39697a83b5 Shrinkify the machine operand creation method names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 00:45:46 +00:00
Chris Lattner
c8313f1d79 switch MIBuilder over to use the simplified operand addition methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 00:35:18 +00:00
Chris Lattner
7ed47a1335 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:42 +00:00