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

7280 Commits

Author SHA1 Message Date
Devang Patel
5f93a737f6 Simplify debug info intrisinc lowering.
llvm-svn: 74733
2009-07-02 22:43:26 +00:00
Douglas Gregor
b523a25108 CMake build fixes, from Xerxes Ranby
llvm-svn: 74720
2009-07-02 18:53:52 +00:00
Bruno Cardoso Lopes
810ef07890 shrinking down #includes
llvm-svn: 74718
2009-07-02 18:29:24 +00:00
Bruno Cardoso Lopes
bd4ae81317 Remove getFunctionAlignment from TargetELFInfo and use new MachineFunction alignment method
llvm-svn: 74686
2009-07-02 02:13:13 +00:00
Devang Patel
735f7d53ca Simplify.
llvm-svn: 74677
2009-07-02 00:28:03 +00:00
Devang Patel
2e373cdc9f Simplify. No intentional functionality change.
llvm-svn: 74673
2009-07-02 00:08:09 +00:00
Devang Patel
1fececd8c1 Refactor. No functionality change.
llvm-svn: 74659
2009-07-01 23:19:01 +00:00
Devang Patel
9149c185a4 llvm.dbg.declare is always used for local variable's debug info.
llvm-svn: 74625
2009-07-01 18:51:07 +00:00
Evan Cheng
e6989735a6 CommuteChangesDestination() should check if to-be-commuted instruction defines any register. Also teaches the default commuteInstruction() to commute instruction without definitions (e.g. X86::test / ARM::tsp).
llvm-svn: 74602
2009-07-01 08:29:08 +00:00
Evan Cheng
7d78cb531e Remove special handling of implicit_def. Fix a couple more bugs in liveintervalanalysis and coalescer handling of implicit_def.
Note, isUndef marker must be placed even on implicit_def def operand or else the scavenger will not ignore it. This is necessary because -O0 path does not use liveintervalanalysis, it treats implicit_def just like any other def.

llvm-svn: 74601
2009-07-01 08:19:36 +00:00
Evan Cheng
37503e9671 Handle IMPLICIT_DEF with isUndef operand marker, part 2. This patch moves the code to annotate machineoperands to LiveIntervalAnalysis. It also add markers for implicit_def that define physical registers. The rest, is just a lot of details.
llvm-svn: 74580
2009-07-01 01:59:31 +00:00
Daniel Dunbar
bc3d149e98 Remove unused AsmPrinter OptLevel argument, and propogate.
- This more or less amounts to a revert of r65379. I'm curious to know what
   happened that caused this variable to become unused.

llvm-svn: 74579
2009-07-01 01:48:54 +00:00
Bill Wendling
c0fb316bd3 Add an "alignment" field to the MachineFunction object. It makes more sense to
have the alignment be calculated up front, and have the back-ends obey whatever
alignment is decided upon.

This allows for future work that would allow for precise no-op placement and the
like.

llvm-svn: 74564
2009-06-30 22:38:32 +00:00
Evan Cheng
28b9e77f19 Temporarily restore the scavenger implicit_def checking code. MachineOperand isUndef mark is not being put on implicit_def of physical registers (created for parameter passing, etc.).
llvm-svn: 74519
2009-06-30 09:19:42 +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
Devang Patel
e35cd91347 Struct types are described using field types only.
llvm-svn: 74477
2009-06-29 23:46:50 +00:00
Devang Patel
bff451b95b s/MainCU/ModuleCU/g
llvm-svn: 74452
2009-06-29 20:45:18 +00:00
Devang Patel
4ba8cbff55 Multiple DW_TAG_compile_unit is not used, afaict, on any target.
Update dwarf writer to only emit one DW_TAG_compile_unit per .o file. 

llvm-svn: 74449
2009-06-29 20:38:13 +00:00
Dan Gohman
e25e17d91e Eliminate a layer of indirection in LoopInfo and MachineLoopInfo.
llvm-svn: 74394
2009-06-27 21:22:48 +00:00
Chris Lattner
0ce83b0e95 When doing remat, don't consider uses of non-allocatable physregs. Patch
by Evan.

llvm-svn: 74370
2009-06-27 04:06:41 +00:00
Chris Lattner
ce7f3c052e fix a typo that GCC should have caught that causes crashes with -view-*-dags
llvm-svn: 74364
2009-06-27 00:57:02 +00:00
Chris Lattner
ca9aefcc93 fix a really subtle bug in the cross section of aliases and TLS:
the SelectionDAG::getGlobalAddress function properly looks through
aliases to determine thread-localness, but then passes the GV* down
to GlobalAddressSDNode::GlobalAddressSDNode which does not.  Instead
of passing down isTarget, just pass down the predetermined node
opcode.  This fixes some assertions with out of tree changes I'm 
working on.

llvm-svn: 74325
2009-06-26 21:14:05 +00:00
Owen Anderson
0cf6b34d5d Get rid of these cache variables, which are a holdover from the days when
we had multiple type planes and these lookups were expensive.

llvm-svn: 74319
2009-06-26 20:33:47 +00:00
Chris Lattner
0fee902c2d implement DOTGraphTraits<SelectionDAG*>::getNodeLabel in terms of
SDNode::print_details to eliminate a ton of near-duplicate code.

llvm-svn: 74311
2009-06-26 19:06:10 +00:00
Douglas Gregor
6d9b0e8c19 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
llvm-svn: 74285
2009-06-26 15:37:00 +00:00
Chris Lattner
05eabf4f95 dot graph viewing is apparently not using SDNode::print_details, this is bad,
but in the meantime lets print targetflags on node labels.

llvm-svn: 74274
2009-06-26 05:55:43 +00:00
Chris Lattner
3aef0c897e propagate target operand flags from dag nodes into MachineOperands.
llvm-svn: 74273
2009-06-26 05:52:14 +00:00
Chris Lattner
181d139bc3 fit in 80 cols
llvm-svn: 74270
2009-06-26 05:39:02 +00:00
Devang Patel
84a8914a4a Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.

llvm-svn: 74251
2009-06-26 01:49:18 +00:00
Devang Patel
32bbebe82f Simplify.
llvm-svn: 74215
2009-06-25 22:36:02 +00:00
Chris Lattner
6a77e841e8 add targetflags to jump tables and constant pool entries.
llvm-svn: 74204
2009-06-25 21:35:31 +00:00
Chris Lattner
f94959f1a3 allow setting target operand flags on TargetGlobalAddress nodes.
llvm-svn: 74203
2009-06-25 21:21:14 +00:00
Chris Lattner
55fdaaf6e7 start bringing targetoperand flags into isel, first up, ExternalSymbol.
llvm-svn: 74199
2009-06-25 18:45:50 +00:00
Owen Anderson
76d92148a7 Provide guards for this shared structure. I'm not sure this actually needs
to be shared, but how/where to privatize it is not immediately clear to me.

If any SelectionDAG experts see a better solution, please share!

llvm-svn: 74180
2009-06-25 17:09:00 +00:00
Owen Anderson
7bc2987c5c Privatize some more debug-related static data.
llvm-svn: 74179
2009-06-25 16:55:32 +00:00
Bruno Cardoso Lopes
5e0be0b9a1 Support Constant Pool Sections
Add section symbols to the symbol table

llvm-svn: 74170
2009-06-25 07:36:24 +00:00
Bill Wendling
edfdb32218 My guess is that RegInfo should only call the Allocator.Deallocator if it's not
null.

llvm-svn: 74147
2009-06-25 00:32:48 +00:00
Owen Anderson
696fd9b29e Now with EVEN FEWER statics!
llvm-svn: 74143
2009-06-25 00:04:15 +00:00
Owen Anderson
a21f94d6ba Fewer static variables, part 3 of many.
llvm-svn: 74140
2009-06-24 23:41:44 +00:00
Owen Anderson
e194f62a43 Down with _even more_ statics!
llvm-svn: 74137
2009-06-24 23:13:56 +00:00
Owen Anderson
7b32a5b971 Down with statics!
llvm-svn: 74134
2009-06-24 22:53:20 +00:00
Owen Anderson
9832095b30 Move local statics to per-instance variables.
llvm-svn: 74132
2009-06-24 22:28:12 +00:00
Lang Hames
b9f524d565 Completed basic intra block split implementation.
llvm-svn: 74114
2009-06-24 20:46:24 +00:00
David Greene
08b3d807e8 This increases the maximum for MVT::LAST_VALUETYPE
This change doubles the allowable value for MVT::LAST_VALUETYPE. It does
this by doing several things.

1. Introduces MVT::MAX_ALLOWED_LAST_VALUETYPE which in this change has a
value of 64.  This value contains the current maximum for the
MVT::LAST_VALUETYPE.

2. Instead of checking "MVT::LAST_VALUETYPE <= 32", all of those uses
now become "MVT::LAST_VALUETYPE <= MVT::MAX_ALLOWED_LAST_VALUETYPE"

3. Changes the dimension of the ValueTypeActions from 2 elements to four
elements and adds comments ahead of the declaration indicating the it is
"(MVT::MAX_ALLOWED_LAST_VALUETYPE/32) * 2".  This at least lets us find
what is affected if and when MVT::MAX_ALLOWED_LAST_VALUETYPE gets
changed.

4. Adds initializers for the new elements of ValueTypeActions.

This does NOT add any types in MVT. That would be done separately.

This doubles the size of ValueTypeActions from 64 bits to 128 bits and
gives us the freedom to add more types for AVX.

llvm-svn: 74110
2009-06-24 19:41:55 +00:00
Chris Lattner
ee30c14d3b sink management of DwarfWriter & MachineModuleInfo into the AsmPrinter base class.
llvm-svn: 74101
2009-06-24 19:09:55 +00:00
Chris Lattner
d59a5b9f8b sink dwarf finalization out of each target into AsmPrinter::doFinalization
llvm-svn: 74097
2009-06-24 18:54:37 +00:00
Chris Lattner
0690755320 eliminate the ExtWeakSymbols set from AsmPrinter. This eliminates
a bunch of code from all the targets, and eliminates nondeterministic
ordering of directives being emitted in the output.

llvm-svn: 74096
2009-06-24 18:52:01 +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
Owen Anderson
90f7655f57 Get rid of the global CFGOnly flag by threading a ShortNames parameters through the GraphViz rendering code.
Update other uses in the codebase for this change.

llvm-svn: 74084
2009-06-24 17:37:09 +00:00
Dale Johannesen
5bad20bda8 Rewrite 73900 per Duncan's suggestion.
llvm-svn: 74082
2009-06-24 17:11:31 +00:00
Chris Lattner
07463b0a0a remove dead makefile flags.
llvm-svn: 74065
2009-06-24 05:29:56 +00:00
Lang Hames
38bf7cf4e2 Fixed a bug in LiveInterval scaling (failure to scale VNI defs correctly), removed old TODO comments.
llvm-svn: 74054
2009-06-24 02:17:32 +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
Bruno Cardoso Lopes
bd023b8ebe Use a default alignment for data and bss sections.
Only pad when the section size > 0 and move the code that deals
with globals initializers to a place we know for sure the global
is initialized.

llvm-svn: 73944
2009-06-23 04:39:27 +00:00
Dale Johannesen
e577db0efd Fix memcpy expansion so it won't generate invalid
types for the target (I think).  This was breaking
the PPC32 calling sequence.

llvm-svn: 73900
2009-06-22 20:59:07 +00:00
Evan Cheng
2410955c62 Fix another register coalescer crash: forgot to check if the instruction being updated has already been coalesced.
llvm-svn: 73898
2009-06-22 20:49:32 +00:00
Bruno Cardoso Lopes
4615b9cdf9 Use different functions to emit the string and symbol tables.
llvm-svn: 73895
2009-06-22 19:29:56 +00:00
Bruno Cardoso Lopes
7b196ba30e Add more methods to gather target specific elf stuff
Support for .text relocations, implementing TargetELFWriter overloaded methods for x86/x86_64.
Use a map to track global values to their symbol table indexes
Code cleanup and small fixes

llvm-svn: 73894
2009-06-22 19:16:16 +00:00
Evan Cheng
b45918e5bb Fix PR4419: handle defs of partial uses.
llvm-svn: 73816
2009-06-20 04:34:51 +00:00
Devang Patel
e2b1c9a530 mv CodeGen/DebugLoc.h Support/DebugLoc.h
llvm-svn: 73786
2009-06-19 22:08:58 +00:00
Devang Patel
35810cd07b Move up dwarf writer initialization in common AsmPrinter class.
llvm-svn: 73784
2009-06-19 21:54:26 +00:00
Eli Friedman
eb83635a7e Minor cleanup; fixes review comments for a previous patch. Sorry for
taking so long to get to this!

llvm-svn: 73757
2009-06-19 06:01:55 +00:00
Lang Hames
1bade5ff09 More VNInfo tweaking, plus a little progress on intra-block splitting.
llvm-svn: 73750
2009-06-19 02:17:53 +00:00
Chris Lattner
6cd267dcc5 move mangler quote handling from asm printers to TargetAsmInfo.
llvm-svn: 73738
2009-06-18 23:41:35 +00:00
Chris Lattner
ea0ea2f4bc simplify macro debug info directive handling.
llvm-svn: 73736
2009-06-18 23:31:37 +00:00
Lang Hames
7f288c29af Improved PHI def marking, replaced some gotos with breaks.
llvm-svn: 73727
2009-06-18 22:01:47 +00:00
Evan Cheng
6c1c55f942 On Darwin, ams printer should output a second label before a jump table so the linker knows it's a new atom. But this is only needed if the jump table is put in a separate section from the function body.
llvm-svn: 73720
2009-06-18 20:37:15 +00:00
Evan Cheng
82a8ab8a8e - Update register allocation hint after coalescing. This is done by the target since the hint is target dependent. This is important for ARM register pair hints.
- Register allocator should resolve the second part of the hint (register number) before passing it to the target since it knows virtual register to physical register mapping.
- More fixes to get ARM load / store double word working.

llvm-svn: 73671
2009-06-18 02:04:01 +00:00
Lang Hames
5c64015a56 VNInfo cleanup.
llvm-svn: 73634
2009-06-17 21:01:20 +00:00
Sanjiv Gupta
30e21aabcb Fixed names of libcalls checked in r73480.
llvm-svn: 73483
2009-06-16 10:22:58 +00:00
Sanjiv Gupta
00e60c0154 Added required libcalls for PIC16 (mostly floating points to integer casting operations).
llvm-svn: 73480
2009-06-16 09:03:58 +00:00
Evan Cheng
058f158de0 Rename RemoveCopiesFromValNo to TurnCopiesFromValNoToImpDefs.
llvm-svn: 73479
2009-06-16 07:15:05 +00:00
Evan Cheng
a98ff05fca If a val# is defined by an implicit_def and it is being removed, all of the copies off the val# were removed. This causes problem later since the scavenger will see uses of registers without defs. The proper solution is to change the copies into implicit_def's instead.
TurnCopyIntoImpDef turns a copy into implicit_def and remove the val# defined by it. This causes an scavenger assertion later if the def reaches other blocks. Disable the transformation if the value live interval extends beyond its def block.

llvm-svn: 73478
2009-06-16 07:12:58 +00:00
Eli Friedman
6a984089f4 Add some generic expansion logic for SMULO and UMULO. Fixes UMULO
support for x86, and UMULO/SMULO for many architectures, including PPC 
(PR4201), ARM, and Cell. The resulting expansion isn't perfect, but it's
not bad.

llvm-svn: 73477
2009-06-16 06:58:29 +00:00
Bill Wendling
a41ca56ed4 Fix typos.
llvm-svn: 73464
2009-06-16 04:02:03 +00:00
Devang Patel
5941941827 Use MainCU if it is available.
llvm-svn: 73457
2009-06-16 02:09:30 +00:00
Owen Anderson
3234d9d040 Owen Anderson 2009-06-15: Use a SmallPtrSet here, for speed and to match df_iterator.
Owen Anderson 2009-06-15: Remember to clear out our maps to prevent crashing.

llvm-svn: 73438
2009-06-15 22:54:48 +00:00
Dan Gohman
cf28fb56b0 Change this from an assert to a cerr+exit, since it's diagnosing an
unsupported inline asm construct, rather than verifying a code invariant.

llvm-svn: 73435
2009-06-15 22:32:41 +00:00
Devang Patel
1fb2606b12 Gracefully handle imbalanced inline function begin and end markers.
llvm-svn: 73426
2009-06-15 21:45:50 +00:00
Evan Cheng
4b77794613 ifcvt should ignore cfg where true and false successors are the same.
llvm-svn: 73423
2009-06-15 21:24:34 +00:00
Arnold Schwaighofer
6b340f9247 CheckTailCallReturnConstraints is missing a check on the
incomming chain of the RETURN node. The incomming chain must
be the outgoing chain of the CALL node. This causes the
backend to identify tail calls that are not tail calls. This
patch fixes this.

llvm-svn: 73387
2009-06-15 14:43:36 +00:00
Evan Cheng
3219c7fbe5 Part 1.
- Change register allocation hint to a pair of unsigned integers. The hint type is zero (which means prefer the register specified as second part of the pair) or entirely target dependent.
- Allow targets to specify alternative register allocation orders based on allocation hint.

Part 2.
- Use the register allocation hint system to implement more aggressive load / store multiple formation.
- Aggressively form LDRD / STRD. These are formed *before* register allocation. It has to be done this way to shorten live interval of base and offset registers. e.g.
v1025 = LDR v1024, 0
v1026 = LDR v1024, 0
=>
v1025,v1026 = LDRD v1024, 0

If this transformation isn't done before allocation, v1024 will overlap v1025 which means it more difficult to allocate a register pair.

- Even with the register allocation hint, it may not be possible to get the desired allocation. In that case, the post-allocation load / store multiple pass must fix the ldrd / strd instructions. They can either become ldm / stm instructions or back to a pair of ldr / str instructions.

This is work in progress, not yet enabled.

llvm-svn: 73381
2009-06-15 08:28:29 +00:00
Dan Gohman
111f127d23 Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Evan Cheng
1607bd1fa9 Move register allocation preference (or hint) from LiveInterval to MachineRegisterInfo. This allows more passes to set them.
llvm-svn: 73346
2009-06-14 20:22:55 +00:00
Bruno Cardoso Lopes
d73d79eaf9 Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject.h by Aaron Gray
llvm-svn: 73333
2009-06-14 07:53:21 +00:00
Evan Cheng
d0a66e438f Add a ARM specific pre-allocation pass that re-schedule loads / stores from
consecutive addresses togther. This makes it easier for the post-allocation pass
to form ldm / stm.

This is step 1. We are still missing a lot of ldm / stm opportunities because
of register allocation are not done in the desired order. More enhancements
coming.

llvm-svn: 73291
2009-06-13 09:12:55 +00:00
Devang Patel
bcc1187643 llvm.dbg.region.end() intrinsic is not required to be in _last_ basic block in a function. If that happens then any basic block that follows (lexically) the block with regin.end will not have scope info available. LexicalScopeStack relies on processing basic block in CFG order, but this processing order is not guaranteed. Things get complicated when the optimizer gets a chance to optimizer IR with dbg intrinsics.
Apply defensive patch to preserve at least one lexical scope till the end of function.

llvm-svn: 73282
2009-06-13 02:16:18 +00:00
Owen Anderson
a3bb398631 Improve style.
llvm-svn: 73258
2009-06-12 22:07:19 +00:00
Owen Anderson
247bdbde16 This is supposed to be a preorder numbering of the dominator tree, not the CFG.
llvm-svn: 73257
2009-06-12 21:50:22 +00:00
Owen Anderson
8c879bba61 Now with less iterator invalidation, and other forms of crashing!
llvm-svn: 73256
2009-06-12 21:41:29 +00:00
Evan Cheng
98216808fe If killed register is defined by implicit_def, do not clear it since it's live range may overlap another def of same register.
llvm-svn: 73255
2009-06-12 21:34:26 +00:00
Devang Patel
8d9aa4249a Clear AbstractInstanceRootMap at the end of the function.
llvm-svn: 73244
2009-06-12 19:24:05 +00:00
Bruno Cardoso Lopes
9b68e8653f Support for ELF Visibility
Emission for globals, using the correct data sections
Function alignment can be computed for each target using TargetELFWriterInfo
Some small fixes

llvm-svn: 73201
2009-06-11 19:16:03 +00:00
Oscar Fuentes
c2d42ced17 CMake: Updated list of files on lib/CodeGen/CMakeLists.txt.
llvm-svn: 73174
2009-06-10 22:53:59 +00:00
Sanjiv Gupta
02c9163ae2 Remove warnings: no newline at end of file.
llvm-svn: 73156
2009-06-10 03:42:13 +00:00
Owen Anderson
996a7f7f37 Add the beginnings of an implementatation of lazy liveness analysis, based on "Fast Liveness Checking for SSA-form Programs" by Boissinot, et al.
This is still very early, hasn't been tested, and is not yet well documented.  More to come soon.

llvm-svn: 73141
2009-06-09 19:30:45 +00:00
Bruno Cardoso Lopes
472eb7c299 Delete comment and fix typo
llvm-svn: 73040
2009-06-07 21:49:11 +00:00
Bruno Cardoso Lopes
f7d71605a6 Fix wrong elf class and byte order initializations.
llvm-svn: 73039
2009-06-07 21:33:20 +00:00
Bruno Cardoso Lopes
cfa07266cf Simple ELF32/64 binary files can now be emitted for x86 and x86_64 without
relocation sections.

llvm-svn: 73038
2009-06-07 21:22:38 +00:00
Eli Friedman
2964aa5a38 Tweak the expansion code for BIT_CONVERT to generate better code
converting from an MMX vector to an i64.

llvm-svn: 73024
2009-06-07 09:41:57 +00:00
Eli Friedman
d4b463b0dc Slightly generalize the code that handles shuffles of consecutive loads
on x86 to handle more cases.  Fix a bug in said code that would cause it 
to read past the end of an object.  Rewrite the code in 
SelectionDAGLegalize::ExpandBUILD_VECTOR to be a bit more general. 
Remove PerformBuildVectorCombine, which is no longer necessary with 
these changes.  In addition to simplifying the code, with this change, 
we can now catch a few more cases of consecutive loads.

llvm-svn: 73012
2009-06-07 06:52:44 +00:00
Eli Friedman
2dadbd05f9 Fix the expansion for CONCAT_VECTORS so that it doesn't create illegal
types.

llvm-svn: 72993
2009-06-06 07:08:26 +00:00
Eli Friedman
85675e8547 Factor out a couple of helpers.
llvm-svn: 72992
2009-06-06 07:04:42 +00:00
Bruno Cardoso Lopes
b3b24681ca Remove elf specific info from ELFWriter.h to Elf.h. Code cleanup and more comments added
llvm-svn: 72982
2009-06-06 03:56:29 +00:00
Eli Friedman
c7d37a1c3a Make SINT_TO_FP/UINT_TO_FP vector legalization queries query on the
integer type to be consistent with normal operation legalization.  No visible
change because nothing is actually using this at the moment.

llvm-svn: 72980
2009-06-06 03:27:50 +00:00
Devang Patel
8d170194e8 Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.

llvm-svn: 72959
2009-06-05 21:57:13 +00:00
Nate Begeman
058d4eeccf Adapt the x86 build_vector dagcombine to the current state of the legalizer.
build vectors with i64 elements will only appear on 32b x86 before legalize.
Since vector widening occurs during legalize, and produces i64 build_vector 
elements, the dag combiner is never run on these before legalize splits them
into 32b elements.

Teach the build_vector dag combine in x86 back end to recognize consecutive 
loads producing the low part of the vector.

Convert the two uses of TLI's consecutive load recognizer to pass LoadSDNodes
since that was required implicitly.

Add a testcase for the transform.

Old:
	subl	$28, %esp
	movl	32(%esp), %eax
	movl	4(%eax), %ecx
	movl	%ecx, 4(%esp)
	movl	(%eax), %eax
	movl	%eax, (%esp)
	movaps	(%esp), %xmm0
	pmovzxwd	%xmm0, %xmm0
	movl	36(%esp), %eax
	movaps	%xmm0, (%eax)
	addl	$28, %esp
	ret

New:
	movl	4(%esp), %eax
	pmovzxwd	(%eax), %xmm0
	movl	8(%esp), %eax
	movaps	%xmm0, (%eax)
	ret

llvm-svn: 72957
2009-06-05 21:37:30 +00:00
Dan Gohman
ee407d25ca Remove some unnecessary #includes.
llvm-svn: 72948
2009-06-05 16:32:58 +00:00
Sanjiv Gupta
54575e76f0 Allow libcalls for i16 sdiv/udiv/rem operations.
llvm-svn: 72941
2009-06-05 14:41:10 +00:00
Bruno Cardoso Lopes
23b9f95d35 ELF Code Emitter now uses CurBufferPtr, BufferBegin and BufferEnd, as do JIT and
MachO Writer. This will change with the arrival of ObjectCodeEmitter and
BinaryObject

llvm-svn: 72906
2009-06-05 00:22:10 +00:00
Dan Gohman
5f6f8101d5 Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Dale Johannesen
adb4b4f1de Fix FP_TO_UINT->i32 on ppc32 -mcpu=g5. This was
using Promote which won't work because i64 isn't
a legal type.  It's easy enough to use Custom, but
then we have the problem that when the type
legalizer is promoting FP_TO_UINT->i16, it has no
way of telling it should prefer FP_TO_SINT->i32
to FP_TO_UINT->i32.  I have uncomfortably hacked
this by making the type legalizer choose FP_TO_SINT
when both are Custom.
This fixes several regressions in the testsuite.

llvm-svn: 72891
2009-06-04 20:53:52 +00:00
Evan Cheng
dada49d18a RALinScan::attemptTrivialCoalescing() was returning a virtual register instead of the physical register it is allocated to. This resulted in virtual register(s) being added the live-in sets.
llvm-svn: 72890
2009-06-04 20:53:36 +00:00
Evan Cheng
7f49dfb5fa A value defined by an implicit_def can be liven to a use BB. This is unfortunate. But register allocator still has to add it to the live-in set of the use BB.
llvm-svn: 72889
2009-06-04 20:28:22 +00:00
Lang Hames
563729c80b Removed SimpleRewriter.
llvm-svn: 72880
2009-06-04 18:45:36 +00:00
Dan Gohman
882851fe9f Don't do the X * 0.0 -> 0.0 transformation in instcombine, because
instcombine doesn't know when it's safe. To partially compensate
for this, introduce new code to do this transformation in
dagcombine, which can use UnsafeFPMath.

llvm-svn: 72872
2009-06-04 17:12:12 +00:00
Dan Gohman
76bdd6f844 Fix comments.
llvm-svn: 72870
2009-06-04 16:49:15 +00:00
Dan Gohman
c2061b7d10 Remove a #include of <iostream>.
llvm-svn: 72828
2009-06-04 01:59:35 +00:00
Lang Hames
e4f9b4a57c Removed more testing code that snuck in earlier.
llvm-svn: 72825
2009-06-04 01:04:22 +00:00
Bruno Cardoso Lopes
8fa826d852 Move ELFCodeEmiter stuff to new files
llvm-svn: 72785
2009-06-03 17:47:27 +00:00
Oscar Fuentes
3a964cbc3b CMake: Added missing source file to lib/CodeGen/CMakeLists.txt.
llvm-svn: 72775
2009-06-03 15:29:09 +00:00
Evan Cheng
4e47a019ba Fix for PR4225: When rewriter reuse a value in a physical register , it clear the register kill operand marker and its kill ops information. However, the cleared operand may be a def of a super-register. Clear the kill ops info for the super-register's sub-registers as well.
llvm-svn: 72758
2009-06-03 09:00:27 +00:00
Evan Cheng
085beccfb5 If there is a def of a super-register followed by a use of a sub-register, do *not* add an implicit def of the sub-register. e.g.
EAX = ..., AX<imp-def>
...
    = AX

This creates a double-def. Apparently this used to be necessary but is no longer needed.

Thanks to Anton for pointing this out. Anton, I cannot create a test case without your uncommitted ARM patches. Please check in a test case for me.

llvm-svn: 72755
2009-06-03 05:15:46 +00:00
Bruno Cardoso Lopes
9408fc6842 Move structures and classes into header files, providing two new headers and
one new .cpp file, in preparation for merging in the Direct Object Emission
changes we're working on. No functional changes.
Fixed coding style issues on the original patch. Patch by Aaron Gray

llvm-svn: 72754
2009-06-03 03:43:31 +00:00
Lang Hames
96d4476109 Fixed warning, removed some temporary validation code that snuck in during my last commit.
llvm-svn: 72735
2009-06-02 20:30:03 +00:00
Lang Hames
1a81422fab Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
llvm-svn: 72729
2009-06-02 16:53:25 +00:00
Dale Johannesen
8b6ee9e312 Revert 72707 and 72709, for the moment.
llvm-svn: 72712
2009-06-02 03:12:52 +00:00
Dale Johannesen
c08669561e Make the implicit inputs and outputs of target-independent
ADDC/ADDE use MVT::i1 (later, whatever it gets legalized to)
instead of MVT::Flag.  Remove CARRY_FALSE in favor of 0; adjust
all target-independent code to use this format.

Most targets will still produce a Flag-setting target-dependent
version when selection is done.  X86 is converted to use i32
instead, which means TableGen needs to produce different code
in xxxGenDAGISel.inc.  This keys off the new supportsHasI1 bit
in xxxInstrInfo, currently set only for X86; in principle this
is temporary and should go away when all other targets have
been converted.  All relevant X86 instruction patterns are
modified to represent setting and using EFLAGS explicitly.  The
same can be done on other targets.

The immediate behavior change is that an ADC/ADD pair are no
longer tightly coupled in the X86 scheduler; they can be
separated by instructions that don't clobber the flags (MOV).
I will soon add some peephole optimizations based on using
other instructions that set the flags to feed into ADC.

llvm-svn: 72707
2009-06-01 23:27:20 +00:00
Bill Wendling
c77c8e5f6e Accidental commit. This isn't ready for prime time just yet.
llvm-svn: 72699
2009-06-01 20:18:46 +00:00
Duncan Sands
222fbd50d9 Rename CustomLowerResults to CustomLowerNode, since
it is used both when a result is illegal and when an
operand is illegal.

llvm-svn: 72658
2009-05-31 04:15:38 +00:00
Bruno Cardoso Lopes
aba334e40e Use uint8_t and int32_t in {JIT,Machine}CodeEmiters
llvm-svn: 72650
2009-05-30 23:50:33 +00:00
Bruno Cardoso Lopes
4da7e7af43 First patch in the direction of splitting MachineCodeEmitter in two subclasses:
JITCodeEmitter and ObjectCodeEmitter. No functional changes yet. Patch by Aaron Gray

llvm-svn: 72631
2009-05-30 20:51:52 +00:00
Bill Wendling
8235a05c1a Untabification.
llvm-svn: 72604
2009-05-30 01:09:53 +00:00
Evan Cheng
a36a15ff66 Do not try to create a MVT type of width 0.
llvm-svn: 72557
2009-05-28 23:52:18 +00:00
Eli Friedman
847816ce19 Re-commit r72514 and r72516 with a fixed version of BR_CC lowering.
This patch removes some special cases for opcodes and does a bit of 
cleanup.

llvm-svn: 72536
2009-05-28 20:40:34 +00:00
Evan Cheng
30cec6ac75 Incorporate patch feedbacks.
llvm-svn: 72533
2009-05-28 18:41:02 +00:00
Bill Wendling
772ce6d8be Temporarily revert r72514 (and dependent patch r72516). It was causing this
failure during llvm-gcc bootstrap:

Assertion failed: (!Tmp2.getNode() && "Can't legalize BR_CC with legal condition!"), function ExpandNode, file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp, line 2923.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:1727: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

llvm-svn: 72530
2009-05-28 18:18:59 +00:00
Eli Friedman
1527c49c0d Remove a couple of useless functions.
llvm-svn: 72516
2009-05-28 04:49:34 +00:00
Eli Friedman
bdd4f7f8d3 Remove special cases for more opcodes.
This is basically the end of this series of patches for LegalizeDAG; the 
remaining special cases can't be removed without more infrastructure 
work.  There's a FIXME for each relevant opcode near the beginning of
SelectionDAGLegalize::LegalizeOp.

llvm-svn: 72514
2009-05-28 04:39:57 +00:00
Eli Friedman
9928c800a4 Remove special case for SETCC opcode; add some comments explaining why
some special cases are necessary.

llvm-svn: 72511
2009-05-28 03:56:57 +00:00
Eli Friedman
57e6211262 Some minor cleanups.
llvm-svn: 72509
2009-05-28 03:06:16 +00:00
Evan Cheng
40810c4d1b Added optimization that narrow load / op / store and the 'op' is a bit twiddling instruction and its second operand is an immediate. If bits that are touched by 'op' can be done with a narrower instruction, reduce the width of the load and store as well. This happens a lot with bitfield manipulation code.
e.g.
orl     $65536, 8(%rax)
=>
orb     $1, 10(%rax)

Since narrowing is not always a win, e.g. i32 -> i16 is a loss on x86, dag combiner consults with the target before performing the optimization.

llvm-svn: 72507
2009-05-28 00:35:15 +00:00
Eli Friedman
15bf5ba18b Minor cleanups; add a better explanation for the issue with
BUILD_VECTOR.

llvm-svn: 72469
2009-05-27 12:42:55 +00:00
Eli Friedman
6c08124766 Remove more special cases for opcodes.
llvm-svn: 72468
2009-05-27 12:20:41 +00:00
Eli Friedman
c3c622df8e Remove special cases for more opcodes.
llvm-svn: 72467
2009-05-27 07:58:35 +00:00
Eli Friedman
931b38ecfe Removing more special cases from LegalizeDAG.
llvm-svn: 72465
2009-05-27 07:32:27 +00:00
Eli Friedman
2080604056 Eliminate more special cases for opcodes.
llvm-svn: 72464
2009-05-27 07:05:37 +00:00
Eli Friedman
12fa5c7acf Remove more special cases from LegalizeDAG.
llvm-svn: 72456
2009-05-27 03:33:44 +00:00
Eli Friedman
9a7c584e6a Remove unused argument.
llvm-svn: 72455
2009-05-27 02:21:29 +00:00
Eli Friedman
a6ff2e5bce Remove more opcode special cases.
llvm-svn: 72454
2009-05-27 02:16:40 +00:00