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

33109 Commits

Author SHA1 Message Date
Dan Gohman
b1528d73d1 Re-apply r84295, with fixes to how the loop "top" and "bottom" blocks are
tracked. Instead of trying to manually keep track of these locations
while doing complex modifications, just recompute them when they're needed.
This fixes a bug in which the TopMBB and BotMBB were not correctly updated,
leading to invalid transformations.

llvm-svn: 84598
2009-10-20 04:50:37 +00:00
Evan Cheng
54a5544dd7 Trim unnecessary includes.
llvm-svn: 84597
2009-10-20 04:23:20 +00:00
Dan Gohman
1fe811cd09 Add getTopBlock and getBottomBlock member functions to MachineLoopInfo.
llvm-svn: 84596
2009-10-20 04:16:37 +00:00
Jim Grosbach
ea8ab9a323 Now that all ARM subtargets use frame index scavenging, the Thumb1 requires*
functions are not needed.

llvm-svn: 84587
2009-10-20 01:32:47 +00:00
Evan Cheng
029a85b791 If the physical register being spilled does not have an interval, spill its sub-registers instead.
llvm-svn: 84586
2009-10-20 01:31:09 +00:00
Jim Grosbach
c4acd85bfd Enable post-pass frame index register scavenging for ARM and Thumb2
llvm-svn: 84585
2009-10-20 01:26:58 +00:00
Chris Lattner
8b2fb5c12a lower ARM::MOVi32imm properly.
llvm-svn: 84583
2009-10-20 01:11:37 +00:00
Chris Lattner
b345825d9e add support for external symbols. The mc instprinter can now handle
reasonable code like Codegen/ARM/2009-02-27-SpillerBug.ll, producing 
identical output except for superior formatting of constant pool entries.

llvm-svn: 84582
2009-10-20 00:56:16 +00:00
Chris Lattner
510ca3ebd7 get fancy: support basic block operands. Yay for jumps.
llvm-svn: 84579
2009-10-20 00:52:47 +00:00
Chris Lattner
279abd0841 add supprort for the 'sbit' operand, MOVi apparently has one.
llvm-svn: 84577
2009-10-20 00:46:11 +00:00
Chris Lattner
18bc7716d6 add support for instruction predicates.
llvm-svn: 84575
2009-10-20 00:42:49 +00:00
Chris Lattner
976978de4a implement printSORegOperand, add lowering for the nasty and despicable MOVi2pieces :)
llvm-svn: 84573
2009-10-20 00:40:56 +00:00
Jim Grosbach
ea7293494f Refs: A8-598.
Leave Inst{11-8}, which represents the starting byte index of the extracted
result in the concatenation of the operands and is left unspecified.

Patch by Johnny Chen.

llvm-svn: 84572
2009-10-20 00:38:19 +00:00
Jim Grosbach
aaa0e97800 Add missing encoding bits to NLdSt class of instructions.
Patch by Johnny Chen.

llvm-svn: 84570
2009-10-20 00:19:08 +00:00
Chris Lattner
db0e4f883d X86 should ignore implicit regs when lowering to MCInst also,
no functionality change.

llvm-svn: 84567
2009-10-19 23:35:57 +00:00
Chris Lattner
8a38b12ffe handle addmode4 modifiers, fix a fixme in printRegisterList
by ignoring all implicit regs when lowering.

llvm-svn: 84566
2009-10-19 23:31:43 +00:00
Chris Lattner
5630502650 simplify by using the twine form of GetOrCreateSymbol
llvm-svn: 84565
2009-10-19 23:05:23 +00:00
Jim Grosbach
2fb5eb1264 Enable allocation of R3 in Thumb1
llvm-svn: 84563
2009-10-19 22:57:03 +00:00
Chris Lattner
24d265dae3 use EmitLabel instead of text emission
llvm-svn: 84562
2009-10-19 22:51:16 +00:00
Chris Lattner
df848440d1 add a twine version of MCContext::GetOrCreateSymbol.
llvm-svn: 84561
2009-10-19 22:49:00 +00:00
Chris Lattner
47131861be lower the ARM::CONSTPOOL_ENTRY pseudo op, giving us constant pool entries
like:

@ BB#1:
	.align	2
LCPI1_0:
	.long	L_.str-(LPC0+8)

Note that proper indentation of the label :)

llvm-svn: 84558
2009-10-19 22:33:05 +00:00
Jim Grosbach
c813cf9649 Adjust the scavenge register spilling to allow the target to choose an
appropriate restore location for the spill as well as perform the actual
save and restore.

The Thumb1 target uses this to make sure R12 is not clobbered while a spilled
scavenger register is live there.

llvm-svn: 84554
2009-10-19 22:27:30 +00:00
Chris Lattner
ce9e652b8a add MCInstLower support for lowering ARM::PICADD, a pseudo op for pic stuffola.
llvm-svn: 84553
2009-10-19 22:23:04 +00:00
Owen Anderson
06714a71a9 Refactor lookup_or_add to contain _MUCH_ less duplicated code. Add support for
numbering first class aggregate instructions while we're at it.

llvm-svn: 84547
2009-10-19 22:14:22 +00:00
Chris Lattner
d7d7fee3fe add register list and hacked up addrmode #4 support, we now get this:
_main:
	stmsp! sp!, {r7, lr}
	mov r7, sp
	sub sp, sp, #4
	mov r0, #0
	str r0, [sp]
	ldr r0, LCPI1_0
	bl _printf
	ldr r0, [sp]
	mov sp, r7
	ldmsp! sp!, {r7, pc}

Note the unhappy ldm/stm because of modifiers being ignored.

llvm-svn: 84546
2009-10-19 22:09:23 +00:00
Chris Lattner
8124977463 revert r84540, fixing build breakage I didn't see because of
broken makefile deps :(

llvm-svn: 84544
2009-10-19 21:59:25 +00:00
Chris Lattner
30baeae77d add addrmode2 support, getting us up to:
_main:
	stm , 
	mov r7, sp
	sub sp, sp, #4
	mov r0, #0
	str r0, [sp]
	ldr r0, LCPI1_0
	bl _printf
	ldr r0, [sp]
	mov sp, r7
	ldm , 

llvm-svn: 84543
2009-10-19 21:57:05 +00:00
Chris Lattner
ec500c80c6 add jump tables, constant pools and some trivial global
lowering stuff.  We can now compile hello world to:

_main:
	stm , 
	mov r7, sp
	sub sp, sp, #4
	mov r0, #0
	str r0, 
	ldr r0, 
	bl _printf
	ldr r0, 
	mov sp, r7
	ldm , 

Almost looks like arm code :)

llvm-svn: 84542
2009-10-19 21:53:00 +00:00
Victor Hernandez
a666c49572 Malloc calls are marked NoAlias, so the code below the isMalloc() check makes it redundant. Removing the isMalloc() check.
llvm-svn: 84541
2009-10-19 21:47:22 +00:00
Chris Lattner
4b35be3f3b pass mangler in as a reference instead of a pointer.
llvm-svn: 84540
2009-10-19 21:45:31 +00:00
Chris Lattner
3755b735a0 reduce #includes
llvm-svn: 84536
2009-10-19 21:23:15 +00:00
Chris Lattner
4318ab8ce7 add printing support for SOImm operands, getting us to:
_main:
	stm , 
	mov r7, sp
	sub sp, sp, #4
	mov r0, #0
	str r0, 

llvm-svn: 84535
2009-10-19 21:21:39 +00:00
Owen Anderson
4954f8ef02 Simplify some code.
llvm-svn: 84533
2009-10-19 21:14:57 +00:00
Chris Lattner
241c56bee6 wire up some basic printOperand goodness, giving us stuff like this before
we abort:

_main:
	stm , 
	mov r7, sp
	sub sp, sp, 
	mov r0, 
	str r0, 

llvm-svn: 84532
2009-10-19 20:59:55 +00:00
Chris Lattner
cd8bd77b64 add the files that go with the previous rev
llvm-svn: 84531
2009-10-19 20:21:05 +00:00
Chris Lattner
72c89de0e0 wire up skeletal support for having llc print instructions
through mcinst lowering -> mcinstprinter, when llc is passed
the -enable-arm-mcinst-printer flag.  Currently this
is very "aborty".

llvm-svn: 84530
2009-10-19 20:20:46 +00:00
Owen Anderson
fb4db70d0f Banish ConstantsLock. It's serving no purpose other than slowing things down
at the moment.

llvm-svn: 84529
2009-10-19 20:11:52 +00:00
Chris Lattner
d2f263e74f wire up ARM's printMCInst method. Now llvm-mc should be able to produce
"something" when printing MCInsts, it will just be missing all the 
operand info.

llvm-svn: 84528
2009-10-19 19:59:05 +00:00
Chris Lattner
11fcbad759 stub out a minimal ARMInstPrinter.
llvm-svn: 84527
2009-10-19 19:56:26 +00:00
Chris Lattner
cf8c23d554 remove strings from instructions who are never asmprinted.
All of these "subreg32" modifier instructions are handled
explicitly by the MCInst lowering phase.  If they got to
the asmprinter, they would explode.  They should eventually
be replace with correct use of subregs.

llvm-svn: 84526
2009-10-19 19:51:42 +00:00
Jeffrey Yasskin
fdb36c1a29 Clean up the JITResolver stub/callsite<->function maps.
The JITResolver maps Functions to their canonical stubs and all callsites for
lazily-compiled functions to their target Functions. To make Function
destruction work, I'm going to need to remove all callsites on destruction, so
this patch also adds the reverse mapping for that.

There was an incorrect assumption in here that the only stub for a function
would be the one caused by needing to lazily compile it, while x86-64 far calls
and dlsym-stubs could also cause such stubs, but I didn't look for a test case
that the assumption broke.

This also adds DenseMapInfo<AssertingVH> so I can use DenseMaps instead of
std::maps.

llvm-svn: 84522
2009-10-19 18:49:59 +00:00
Chris Lattner
e3469a4209 simplify code, reducing string thrashing.
llvm-svn: 84521
2009-10-19 18:49:14 +00:00
Chris Lattner
1816e314c6 switch hidden gv stubs to use MachineModuleInfoMachO instead of a custom map.
llvm-svn: 84520
2009-10-19 18:44:38 +00:00
Chris Lattner
b73edceec4 use MachineModuleInfoMachO for non-lazy gv stubs instead of a private map.
llvm-svn: 84519
2009-10-19 18:38:33 +00:00
Anton Korobeynikov
26ed697cf2 Revert r84295, this unbreaks llvm-gcc bootstrap on x86-64/linux
llvm-svn: 84516
2009-10-19 18:21:09 +00:00
Chris Lattner
e7ea33c824 remove dead map
llvm-svn: 84513
2009-10-19 18:11:25 +00:00
Chris Lattner
1598caa700 don't bother trying to avoid emitting redundant constant pool alignment directives.
llvm-svn: 84512
2009-10-19 18:08:02 +00:00
Chris Lattner
385ca4ca8a remove accidental comment.
llvm-svn: 84510
2009-10-19 18:03:41 +00:00
Chris Lattner
bddb00eadd emit .subsections_via_symbols through MCStreamer instead of textually.
llvm-svn: 84509
2009-10-19 18:03:08 +00:00
Chris Lattner
e53fff883a cleanup doFinalization -> EmitEndOfAsmFile.
llvm-svn: 84508
2009-10-19 17:59:19 +00:00
Nate Begeman
181b8fae1b PR 5245 - The imediate size target flag was not set on 3A-prefixed SSSE3 instructions.
llvm-svn: 84506
2009-10-19 17:31:16 +00:00
Dan Gohman
d2e75c9ae0 Fix SplitBlockPredecessors' LoopInfo updating code to handle the case
where a loop's header is being split and it has predecessors which are not
contained by the most-nested loop which contains the loop.
This fixes PR5235.

llvm-svn: 84505
2009-10-19 16:04:50 +00:00
Dan Gohman
5a182b7b78 Fix a typo in a comment.
llvm-svn: 84504
2009-10-19 14:56:05 +00:00
Dan Gohman
05e648bef4 Change a few instance variables to be local variables.
llvm-svn: 84503
2009-10-19 14:52:05 +00:00
Dan Gohman
595545d2e7 Change instnamer to name arguments "arg" instead of "tmp" for clarity, and
to name basic blocks "bb" instead of "BB", for consistency.

llvm-svn: 84502
2009-10-19 14:47:32 +00:00
Torok Edwin
e6df0e6397 Fix PR5247, "lock addq" pattern (and other atomics), it DOES modify EFLAGS.
LLC was scheduling compares before the adds causing wrong branches to be taken
in programs, resulting in misoptimized code wherever atomic adds where used.

llvm-svn: 84485
2009-10-19 11:00:58 +00:00
Chris Lattner
1971f7636b various cleanups.
llvm-svn: 84471
2009-10-19 07:10:59 +00:00
Chris Lattner
3c31b79b45 simplify.
llvm-svn: 84465
2009-10-19 05:51:03 +00:00
Chris Lattner
5f094e66a8 clean up after metadata changes.
llvm-svn: 84463
2009-10-19 05:31:10 +00:00
Nate Begeman
1308a36647 Add support for matching shuffle patterns with palignr.
llvm-svn: 84459
2009-10-19 02:17:23 +00:00
Evan Cheng
80017908bc Spill slots cannot alias.
llvm-svn: 84432
2009-10-18 19:58:47 +00:00
Evan Cheng
eb82c3743a Turn on post-alloc scheduling for x86.
llvm-svn: 84431
2009-10-18 19:57:27 +00:00
Evan Cheng
1f32fa84b0 Oops. I forgot to change the tests first. Disable post-alloc scheduling.
llvm-svn: 84425
2009-10-18 18:31:31 +00:00
Evan Cheng
e921ebe70d -Revert parts of 84326 and 84411. Distinquishing between fixed and non-fixed
stack slots and giving them different PseudoSourceValue's did not fix the
problem of post-alloc scheduling miscompiling llvm itself.
- Apply Dan's conservative workaround by assuming any non fixed stack slots can
alias other memory locations. This means a load from spill slot #1 cannot 
move above a store of spill slot #2. 
- Enable post-alloc scheduling for x86 at optimization leverl Default and above.

llvm-svn: 84424
2009-10-18 18:16:27 +00:00
Evan Cheng
b40322ac49 Only fixed stack objects and spill slots should be get FixedStack PseudoSourceValue.
llvm-svn: 84411
2009-10-18 06:27:36 +00:00
Chris Lattner
0e1b04a0a7 remove some nonascii weird stuff
llvm-svn: 84410
2009-10-18 05:27:44 +00:00
Chris Lattner
236a43f2a2 add some fixme's
llvm-svn: 84408
2009-10-18 05:09:15 +00:00
Chris Lattner
6077ca46bb remove the IndMemRemPass, which only made sense for when malloc/free were intrinsic
instructions.

llvm-svn: 84404
2009-10-18 05:02:09 +00:00
Chris Lattner
5b8e288c5f fix the other issue with ID's, hopefully really fixing the linux build.
llvm-svn: 84403
2009-10-18 04:58:34 +00:00
Chris Lattner
a1aaf47423 fix some problems with ID definitions, which will hopefully fix the build bots.
llvm-svn: 84399
2009-10-18 04:27:14 +00:00
Chris Lattner
8851d6cf9c add function passes for printing various dominator datastructures
accessible through opt.  Patch by Tobias Grosser!

llvm-svn: 84397
2009-10-18 04:10:40 +00:00
Chris Lattner
f202995415 make DOTGraphTraits public, patch by Tobias Grosser!
llvm-svn: 84396
2009-10-18 04:09:11 +00:00
Nick Lewycky
4f6c397742 Fix test/Bindings/Ocaml/vmcore.ml. When IRBuilder::CreateMalloc was removed,
LLVMBuildMalloc was reimplemented but with the bug that it didn't insert the
resulting instruction.

llvm-svn: 84374
2009-10-17 23:52:26 +00:00
Chris Lattner
a72ccc6fee inline isGEP away.
llvm-svn: 84373
2009-10-17 23:48:54 +00:00
Daniel Dunbar
54427e4a2d Fix my -Asserts warning fix.
llvm-svn: 84372
2009-10-17 23:15:04 +00:00
Chris Lattner
2c890dc2b4 Teach vm core to more aggressively fold 'trunc' constantexprs,
allowing it to simplify the crazy constantexprs in the testcases
down to something sensible.  This allows -std-compile-opts to
completely "devirtualize" the pointers to member functions in
the testcase from PR5176.

llvm-svn: 84368
2009-10-17 21:53:27 +00:00
Daniel Dunbar
b67b5bb0b1 Move UnescapeString to a static function for its sole client; its inefficient and broken.
llvm-svn: 84358
2009-10-17 20:43:42 +00:00
Daniel Dunbar
d537c7d394 Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
llvm-svn: 84357
2009-10-17 20:43:29 +00:00
Daniel Dunbar
ccaa5f1d16 Use raw_ostream::write_escaped instead of EscapeString.
llvm-svn: 84356
2009-10-17 20:43:19 +00:00
Daniel Dunbar
5aa3eebc5d Add raw_ostream::write_escaped, for writing escaped strings.
llvm-svn: 84355
2009-10-17 20:43:08 +00:00
Mikhail Glushenkov
e29aaa858c First draft of the OptionPreprocessor.
More to follow...

llvm-svn: 84352
2009-10-17 20:09:29 +00:00
Nick Lewycky
92413b8e2e Emit newlines at the end of instructions too.
llvm-svn: 84348
2009-10-17 19:43:45 +00:00
Daniel Dunbar
0107265e33 Move StringMap's string has function into StringExtras.h
llvm-svn: 84344
2009-10-17 18:21:06 +00:00
Daniel Dunbar
d0736f38d7 Remove unnecessary include.
llvm-svn: 84336
2009-10-17 18:11:57 +00:00
Daniel Dunbar
4d0f5fa69b Suppress -Asserts warning.
llvm-svn: 84327
2009-10-17 09:33:00 +00:00
Evan Cheng
5ab1ccfaee Distinquish stack slots from other stack objects. They (and fixed objects) get FixedStack PseudoSourceValues.
llvm-svn: 84326
2009-10-17 09:20:14 +00:00
Evan Cheng
d941e8b23a Revert 84315 for now. Re-thinking the patch.
llvm-svn: 84321
2009-10-17 07:53:04 +00:00
Evan Cheng
12dd96e2f8 Rename getFixedStack to getStackObject. The stack objects represented are not
necessarily fixed. Only those will negative frame indices are "fixed."

llvm-svn: 84315
2009-10-17 06:22:26 +00:00
Evan Cheng
33ffbd3518 80 col violation.
llvm-svn: 84311
2009-10-17 06:05:11 +00:00
Chris Lattner
7f32b72975 Simplify some code (first hunk) and fix PR5208 (second hunk) by
updating the callgraph when introducing a call.

llvm-svn: 84310
2009-10-17 05:39:39 +00:00
Dan Gohman
0a76c903df Delete an obsolete comment.
llvm-svn: 84300
2009-10-17 01:37:38 +00:00
Victor Hernandez
a25a2890fa Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Dan Gohman
f5225573b7 Enhance CodePlacementOpt's unconditional intra-loop branch elimination logic
to be more general and understand more varieties of loops.

Teach CodePlacementOpt to reorganize the basic blocks of a loop so that
they are contiguous. This also includes a fair amount of logic for preserving
fall-through edges while doing so. This fixes a BranchFolding-ism where blocks
which can't be made to use a fall-through edge and don't conveniently fit
anywhere nearby get tossed out to the end of the function.

llvm-svn: 84295
2009-10-17 00:32:43 +00:00
Victor Hernandez
4d7283f82c Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.

llvm-svn: 84292
2009-10-17 00:00:19 +00:00
Victor Hernandez
00adf339dd HeapAllocSRoA also needs to check if malloc array size can be computed.
llvm-svn: 84288
2009-10-16 23:12:25 +00:00
Mon P Wang
385786cdcf Allow widening of extract subvector
llvm-svn: 84279
2009-10-16 22:05:48 +00:00
Devang Patel
4790ea6ca2 Do not emit name entry for a pointer type.
llvm-svn: 84276
2009-10-16 21:27:43 +00:00
Evan Cheng
e1fbdc5244 Change createPostRAScheduler so it can be turned off at llc -O1.
llvm-svn: 84273
2009-10-16 21:06:15 +00:00
Dan Gohman
ef1f246d88 Move zext and sext casts fed by loads into the same block as the
load, to help SelectionDAG fold them into the loads, unless
conditions are unfavorable.

llvm-svn: 84271
2009-10-16 20:59:35 +00:00
Devang Patel
a4ac3dd8bc Parse PHI instruction with attached metadata.
llvm-svn: 84264
2009-10-16 18:45:49 +00:00
Devang Patel
5920acc861 If there is not any llvm instruction associated with each lexical scope encoded in debug info then create such scope on demand for variable info.
llvm-svn: 84262
2009-10-16 18:18:03 +00:00
Victor Hernandez
6d11519b1f Invert isSafeToGetMallocArraySize check because we return NULL when we don't know the size.
Thanks to Duncan Sands for noticing this bug.

llvm-svn: 84261
2009-10-16 18:08:17 +00:00
Duncan Sands
4cde5474aa Strip trailing white space.
llvm-svn: 84256
2009-10-16 15:20:13 +00:00
Benjamin Kramer
9975abcc38 Update CMake file.
llvm-svn: 84252
2009-10-16 10:29:08 +00:00
Sanjiv Gupta
f516a9b2a4 Cleaned up some code. No functionality change.
llvm-svn: 84251
2009-10-16 08:58:34 +00:00
Evan Cheng
4df1ac5722 I am no spelling bee.
llvm-svn: 84250
2009-10-16 06:18:09 +00:00
Evan Cheng
b1580b5c48 Enable post-alloc scheduling for all ARM variants except for Thumb1.
llvm-svn: 84249
2009-10-16 06:11:08 +00:00
Evan Cheng
dde3e4fe11 If post-alloc scheduler is not enabled, it should return false, not true.
llvm-svn: 84248
2009-10-16 06:10:34 +00:00
Zhongxing Xu
03d844a262 Indent code.
llvm-svn: 84247
2009-10-16 05:42:28 +00:00
Evan Cheng
8685a8ec0c Add comment.
llvm-svn: 84246
2009-10-16 05:33:58 +00:00
Evan Cheng
04e4a8a961 80 column violation.
llvm-svn: 84244
2009-10-16 05:18:39 +00:00
Bob Wilson
c415e33929 Fix more NEON instruction encodings.
Patch by Johnny Chen.

llvm-svn: 84243
2009-10-16 03:58:44 +00:00
Chris Lattner
5d2b384837 Add half precision floating point support (float16) to APFloat,
patch by Peter Johnson! (PR5195)

llvm-svn: 84239
2009-10-16 02:13:51 +00:00
Chris Lattner
87bcf3b242 add haiku support, patch by Paul Davey!
llvm-svn: 84238
2009-10-16 02:06:30 +00:00
Daniel Dunbar
2be596c127 MC: Set symbol values in MachO MCStreamer.
llvm-svn: 84236
2009-10-16 01:58:23 +00:00
Daniel Dunbar
4943610506 Minor formatting tweaks.
llvm-svn: 84235
2009-10-16 01:58:15 +00:00
Daniel Dunbar
0df659c00b MC: Switch assembler API to using MCExpr instead of MCValue.
llvm-svn: 84234
2009-10-16 01:58:03 +00:00
Daniel Dunbar
022b59a0b5 MC: Remove unneeded context argument to MCExpr::Evaluate*.
llvm-svn: 84233
2009-10-16 01:57:52 +00:00
Daniel Dunbar
af3162e523 MC: Tweak variable assignment diagnostics, and make reassignment of non-absolute
variables and symbols invalid.

llvm-svn: 84232
2009-10-16 01:57:39 +00:00
Daniel Dunbar
a4df6e46a4 MC: When parsing a variable reference, substitute absolute variables immediately
since they are allowed to be redefined.

llvm-svn: 84230
2009-10-16 01:34:54 +00:00
Daniel Dunbar
6b7edc035b MC: Move assembler variable values from MCContext to MCSymbol.
llvm-svn: 84229
2009-10-16 01:33:57 +00:00
Daniel Dunbar
c5165c4258 MC: Switch MCContext value table to storing MCExprs.
llvm-svn: 84228
2009-10-16 01:33:11 +00:00
Evan Cheng
54b34ff68d When checking aliases between phi sources and V2, we know the sources are not themselves phi nodes. However, V2 may be. Call aliasCheck with V2 first to potentially eliminate a std::swap call.
llvm-svn: 84226
2009-10-16 00:33:09 +00:00
Bob Wilson
60ffc7b6b9 Revert svn r80498 and replace it with a different solution. The only problem
I can see with the original code was that I forgot that this runs after
type legalization and hence the result type will always be i32. (Custom
legalization of EXTRACT_VECTOR_ELT is only enabled for vector types with
8- and 16-bit elements.)

Regarding the FIXME comment: any information about sign and zero-extension
should be captured by separate extension operations.  The DAG combiner should
handle those to produce either VGETLANEu or VGETLANEs, and that seems to be
working now.  If there are cases that we're missing, let me know.

llvm-svn: 84218
2009-10-15 23:12:05 +00:00
Anton Korobeynikov
7d6c12de5b Dllexport stuff cleanup:
1. Emit external function type information for all COFF targets since it's
a feature of object format
2. Emit linker directives only for cygming (since this is ld-specific stuff)

llvm-svn: 84214
2009-10-15 22:36:18 +00:00
Sandeep Patel
c0762ba283 Branches must be the last instruction in a Thumb2 IT block. Approved by Evan Cheng.
llvm-svn: 84212
2009-10-15 22:25:32 +00:00
Bob Wilson
aa08dec009 Fix encoding bits for N3VLInt3_QHS multiclass with 8-bit elements.
Patch by Johnny Chen.

llvm-svn: 84206
2009-10-15 21:57:47 +00:00
Kevin Enderby
f2a8226515 Fix ARM memory operand parsing of post indexing with just a base register, that
is just "[Rn]" and no tailing comma with an offset, etc.

llvm-svn: 84205
2009-10-15 21:42:45 +00:00
Bob Wilson
cea08d0d4a Fix a potential performance problem in placing ARM constant pools.
In the case where there are no good places to put constants and we fall back
upon inserting unconditional branches to make new blocks, allow all constant
pool references in range of those blocks to put constants there, even if that
means resetting the "high water marks" for those references.  This will still
terminate because you can't keep splitting blocks forever, and in the bad
cases where we have to split blocks, it is important to avoid splitting more
than necessary.

llvm-svn: 84202
2009-10-15 20:49:47 +00:00
Kevin Enderby
48a0aac679 More bits of the ARM target assembler for llvm-mc, code added to parse labels
as expressions, code for parsing a few arm specific directives (still needs
the MCStreamer calls for these).  Some clean up of the operand parsing code
and adding some comments.

llvm-svn: 84201
2009-10-15 20:48:48 +00:00
Evan Cheng
0a57c7d459 Remove X86Subtarget::IsLinux. It's no longer being used.
llvm-svn: 84200
2009-10-15 20:23:21 +00:00
Victor Hernandez
603a11de4e Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
identifying the malloc as a non-array malloc.  This broke GlobalOpt's optimization of stores of mallocs 
to global variables.

The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized

getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their 
malloc optimization if this function returns NULL.

Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.

llvm-svn: 84199
2009-10-15 20:14:52 +00:00
Benjamin Kramer
44c164e005 Add files Sanjiv forgot.
llvm-svn: 84196
2009-10-15 19:46:34 +00:00
Sanjiv Gupta
d279da3360 Re-apply 84180 with the fixed test case.
llvm-svn: 84195
2009-10-15 19:26:25 +00:00
Jakob Stoklund Olesen
311774b780 Move Blackfin intrinsics into the Target/Blackfin directory.
llvm-svn: 84194
2009-10-15 18:50:52 +00:00
Jakob Stoklund Olesen
2ba26ceb11 Report errors correctly for unselected target intrinsics.
llvm-svn: 84193
2009-10-15 18:50:03 +00:00
Jakob Stoklund Olesen
2fe044dcb7 Clean up TargetIntrinsicInfo API. Add pure virtual methods.
llvm-svn: 84192
2009-10-15 18:49:26 +00:00
Nick Lewycky
7ec7f1ce0f Add missing break statements! Thanks to Duncan Sands for pointing this out!
llvm-svn: 84191
2009-10-15 18:48:58 +00:00
Daniel Dunbar
609b7287b8 Revert "Complete Rewrite of AsmPrinter, TargetObjectFile based on new
PIC16Section class", it breaks globals.ll.

llvm-svn: 84184
2009-10-15 15:02:14 +00:00
Sanjiv Gupta
feff117097 Complete Rewrite of AsmPrinter, TargetObjectFile based on new PIC16Section class
derived from MCSection.

llvm-svn: 84180
2009-10-15 10:10:43 +00:00
Sanjiv Gupta
cd427f0fbc Few changes to comply with new DebugInfo Metadata representation.
llvm-svn: 84179
2009-10-15 09:48:25 +00:00
Nick Lewycky
4ba7b77812 Teach basicaa about memcpy/memmove/memset. The length argument can be used to
improve alias results if constant, and the source pointer can't be modified.

llvm-svn: 84175
2009-10-15 07:11:24 +00:00
Nick Lewycky
14a06f7051 Teach BasicAA to use the size parameter of the memory use marker intrinsics.
llvm-svn: 84174
2009-10-15 06:12:11 +00:00
Bob Wilson
53689872bd Be smarter about reusing constant pool entries.
llvm-svn: 84173
2009-10-15 05:52:29 +00:00
Bob Wilson
bfaed16c37 Fix another problem with ARM constant pools. Radar 7303551.
When ARMConstantIslandPass cannot find any good locations (i.e., "water") to
place constants, it falls back to inserting unconditional branches to make a
place to put them.  My recent change exposed a problem in this area.  We may
sometimes append to the same block more than one unconditional branch.  The
symptoms of this are that the generated assembly has a branch to an undefined
label and running llc with -debug will cause a seg fault.

This happens more easily since my change to prevent CPEs from moving from
lower to higher addresses as the algorithm iterates, but it could have
happened before.  The end of the block may be in range for various constant
pool references, but the insertion point for new CPEs is not right at the end
of the block -- it is at the end of the CPEs that have already been placed
at the end of the block.  The insertion point could be out of range.  When
that happens, the fallback code will always append another unconditional
branch if the end of the block is in range.

The fix is to only append an unconditional branch if the block does not
already end with one.  I also removed a check to see if the constant pool load
instruction is at the end of the block, since that is redundant with
checking if the end of the block is in-range.

There is more to be done here, but I think this fixes the immediate problem.

llvm-svn: 84172
2009-10-15 05:10:36 +00:00
Chris Lattner
389f4efae7 only try to fold constantexpr operands when the worklist is first populated,
don't bother every time going around the main worklist.  This speeds up a 
release-asserts opt -std-compile-opts on 403.gcc by about 4% (1.5s).  It
seems to speed up the most expensive instances of instcombine by ~10%.

llvm-svn: 84171
2009-10-15 04:59:28 +00:00
Chris Lattner
ddfa3af584 don't bother calling ConstantFoldInstruction unless there is a use of the
instruction (which disqualifies stores, unreachable, etc) and at least the
first operand is a constant.  This filters out a lot of obvious cases that
can't be folded.  Also, switch the IRBuilder to a TargetFolder, which tries
harder.

llvm-svn: 84170
2009-10-15 04:13:44 +00:00
Nick Lewycky
a12f6e8f78 Take advantage of TargetData when available; we know that the atomic intrinsics
only dereference the element they point to directly with no pointer arithmetic.

llvm-svn: 84159
2009-10-15 00:36:35 +00:00
Dan Gohman
27c126770a Make CodePlacementOpt align loops, rather than loop headers. The
header is just the entry block to the loop, and it needn't be at
the top of the loop in the code layout.

Remove the code that suppressed loop alignment for outer loops,
so that outer loops are aligned.

llvm-svn: 84158
2009-10-15 00:36:22 +00:00
Evan Cheng
f46b194f84 When LiveVariables is adding implicit-def to model "partial dead", add the earlyclobber marker if the superreg def has it.
llvm-svn: 84153
2009-10-14 23:39:27 +00:00
Evan Cheng
f57950d75b Print earlyclobber for implicit-defs as well.
llvm-svn: 84152
2009-10-14 23:37:31 +00:00
Bob Wilson
db95c227fa Fix instruction encoding bits for NEON VPADAL.
Patch by Johnny Chen.

llvm-svn: 84146
2009-10-14 21:43:17 +00:00
Bob Wilson
1554029c7c Remove unused variables to fix build warning.
llvm-svn: 84144
2009-10-14 21:40:45 +00:00
Jim Grosbach
8da653b238 Make loop not recalc getNumOperands() each time around
llvm-svn: 84138
2009-10-14 21:22:39 +00:00
Devang Patel
22761afada Add support to record DbgScope as inlined scope.
llvm-svn: 84134
2009-10-14 21:08:09 +00:00
Jim Grosbach
9233bebc36 quiet compiler warning
llvm-svn: 84133
2009-10-14 21:07:11 +00:00
Jim Grosbach
d86f233722 Inst{11-8} for vshl should be 0b0101, not 0b1111.
Refs: A7-17 & A8-750.

Patch by Johnny Chen.

llvm-svn: 84131
2009-10-14 20:31:01 +00:00
Bob Wilson
c9b704f66c Set instruction encoding bits 4 and 7 for ARM register-register and
register-shifted-register instructions.  Patch by Johnny Chen.

llvm-svn: 84124
2009-10-14 19:00:24 +00:00
Bob Wilson
320891060f Refactor code to select NEON VST intrinsics.
llvm-svn: 84122
2009-10-14 18:32:29 +00:00
Devang Patel
89ef6dcb54 Use isVoidTy()
llvm-svn: 84118
2009-10-14 17:29:00 +00:00
Bob Wilson
2b19bbea06 Refactor code to select NEON VLD intrinsics.
llvm-svn: 84117
2009-10-14 17:28:52 +00:00
Devang Patel
95b6efe972 Add copyMD to copy metadata from one instruction to another instruction.
llvm-svn: 84113
2009-10-14 17:02:49 +00:00
Bob Wilson
5dbe1c0143 More refactoring. NEON vst lane intrinsics can share almost all the code for
vld lane intrinsics.

llvm-svn: 84110
2009-10-14 16:46:45 +00:00
Bob Wilson
7623a1ce5c Refactor code for selecting NEON load lane intrinsics.
llvm-svn: 84109
2009-10-14 16:19:03 +00:00
Duncan Sands
4fcf6123dd I don't see any point in having both eh.selector.i32 and eh.selector.i64,
so get rid of eh.selector.i64 and rename eh.selector.i32 to eh.selector.
Likewise for eh.typeid.for.  This aligns us with gcc, which always uses a
32 bit value for the selector on all platforms.  My understanding is that
the register allocator used to assert if the selector intrinsic size didn't
match the pointer size, and this was the reason for introducing the two
variants.  However my testing shows that this is no longer the case (I
fixed some bugs in selector lowering yesterday, and some more today in the
fastisel path; these might have caused the original problems).

llvm-svn: 84106
2009-10-14 16:11:37 +00:00
Chris Lattner
a1f5264dd2 make instcombine's instruction sinking more aggressive in the
presence of PHI nodes.

llvm-svn: 84103
2009-10-14 15:21:58 +00:00
Evan Cheng
37a7a18748 Clear VisitedPHIs after use.
llvm-svn: 84080
2009-10-14 06:46:26 +00:00
Evan Cheng
907fd9c3fb Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.

llvm-svn: 84079
2009-10-14 06:41:49 +00:00
Evan Cheng
c1056d9269 More code clean up based on patch feedback.
llvm-svn: 84074
2009-10-14 05:22:03 +00:00
Evan Cheng
efc0f806a4 Change VisitedPHIs into an instance variable that's freed by each alias() call.
llvm-svn: 84072
2009-10-14 05:05:02 +00:00
Dan Gohman
76221cc874 Make isSafeToClobberEFLAGS more aggressive. Teach it to scan backwards
(for uses marked kill and defs marked dead) a few instructions in
addition to forwards. Also, increase the maximum number of instructions
to scan, as it appears to help in a fair number of cases.

llvm-svn: 84061
2009-10-14 00:08:59 +00:00
Dan Gohman
49946908b4 This remat entry is basically done. There are hooks to allow targets
to remat non-load instructions as loads, and the remat code now uses
the UnmodeledSideEffects flags, MachineMemOperands, and similar things
to decide which instructions are valid for rematerialization.

llvm-svn: 84060
2009-10-14 00:02:01 +00:00
Dan Gohman
d845fbc307 Add a few README.txt items.
llvm-svn: 84059
2009-10-13 23:58:05 +00:00
Kevin Enderby
8d8e57983a Correct comment about ARM immediates using '#' not '$' and TODO for modifiers.
llvm-svn: 84055
2009-10-13 23:33:38 +00:00
Devang Patel
72f708ec2f s/DebugLoc.CompileUnit/DebugLoc.Scope/g
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g

llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Devang Patel
81485d992b Check void type before using RAUWd.
llvm-svn: 84049
2009-10-13 22:56:32 +00:00
Bob Wilson
a98883deaa More Neon clean-up: avoid the need for custom-lowering vld/st-lane intrinsics
by creating TargetConstants during instruction selection instead of during
legalization.

llvm-svn: 84042
2009-10-13 22:29:24 +00:00
Kevin Enderby
959ec973ad More bits of the ARM target assembler for llvm-mc to parse immediates.
Also fixed a couple of coding style things that crept in.  And added more
to the temporary hacked up ARMAsmParser::MatchInstruction() method for testing.

llvm-svn: 84040
2009-10-13 22:19:02 +00:00
Evan Cheng
3130aba687 Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
llvm-svn: 84038
2009-10-13 22:02:20 +00:00
Bob Wilson
88df19e49a NEON VLD/VST are now fully implemented. For operations that expand to
multiple instructions, the expansion is done during selection so there is
no need to do anything special during legalization.

llvm-svn: 84036
2009-10-13 21:55:24 +00:00
Devang Patel
20d88f9e16 Do not check use_empty() before replaceAllUsesWith(). This gives ValueHandles a chance to get properly updated.
llvm-svn: 84033
2009-10-13 21:41:20 +00:00
Jeffrey Yasskin
8a0bdbb7f3 Keep track of stubs that are created. This fixes PR5162 and probably PR4822 and
4406. Patch by Nick Lewycky!

llvm-svn: 84032
2009-10-13 21:32:57 +00:00
Duncan Sands
d4a35e9f36 Introduce new convenience methods for sign extending or
truncating an SDValue (depending on whether the target
type is bigger or smaller than the value's type); or zero
extending or truncating it.  Use it in a few places (this
seems to be a popular operation, but I only modified cases
of it in SelectionDAGBuild).  In particular, the eh_selector
lowering was doing this wrong due to a repeated rather than
inverted test, fixed with this change.

llvm-svn: 84027
2009-10-13 21:04:12 +00:00
Bob Wilson
d66a3fd73b Revise ARM inline assembly memory operands to require the memory address to
be in a register.  The previous use of ARM address mode 2 was completely
arbitrary and inappropriate for Thumb.  Radar 7137468.

llvm-svn: 84022
2009-10-13 20:50:28 +00:00
Dale Johannesen
7db511a23e Add an "msasm" flag to inline asm as suggested in PR 5125.
A little ugliness is accepted to keep the binary file format
compatible.  No functional change yet.

llvm-svn: 84020
2009-10-13 20:46:56 +00:00
Sandeep Patel
af459ed32d Fix method name in comment, per Bob Wilson.
llvm-svn: 84017
2009-10-13 20:25:58 +00:00
Dan Gohman
c5a7668904 Use the new CodeMetrics class to compute code size instead of
manually counting instructions.

llvm-svn: 84016
2009-10-13 20:12:23 +00:00
Dan Gohman
c1e210fa10 Compute a full cost value even when a setjmp call is found.
llvm-svn: 84015
2009-10-13 20:10:10 +00:00
Dan Gohman
665e336185 Split code not specific to Function inlining out into a separate class,
named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo
back to FunctionInfo.

llvm-svn: 84013
2009-10-13 19:58:07 +00:00
David Goodwin
d23db026b6 Add debugging output.
llvm-svn: 84011
2009-10-13 19:16:03 +00:00
Sandeep Patel
1584038783 Add ARMv6T2 SBFX/UBFX instructions. Approved by Anton Korobeynikov.
llvm-svn: 84009
2009-10-13 18:59:48 +00:00
Ted Kremenek
1f746d5df3 Update CMake file (lexically order files).
llvm-svn: 84008
2009-10-13 18:57:27 +00:00
Devang Patel
8f81b906ab Do not write empty METADATA_ATTACHMENT record.
llvm-svn: 84006
2009-10-13 18:51:28 +00:00
Devang Patel
934fb4274a Remove unnecessary assert.
llvm-svn: 84004
2009-10-13 18:51:03 +00:00
Benjamin Kramer
679377c816 Update the other CMake file.
llvm-svn: 84003
2009-10-13 18:50:54 +00:00
Devang Patel
e911e90808 Parse GEP with attached custom metadata. This happens during libprofile_rt.bca build.
llvm-svn: 84002
2009-10-13 18:49:55 +00:00
Ted Kremenek
dd5d38175d Update CMake file.
llvm-svn: 84001
2009-10-13 18:48:07 +00:00
Evan Cheng
84c5224fa2 Refactor some code. No functionality changes.
llvm-svn: 84000
2009-10-13 18:42:04 +00:00
Dan Gohman
81218aa90e Commit the removal of this file, which is now moved to lib/Analysis.
llvm-svn: 83999
2009-10-13 18:37:20 +00:00
Dan Gohman
18cdd7ef1b Move the InlineCost code from Transforms/Utils to Analysis.
llvm-svn: 83998
2009-10-13 18:30:07 +00:00