Commit Graph

29233 Commits

Author SHA1 Message Date
Chris Lattner
18c5987fa3 Reimplement rip-relative addressing in the X86-64 backend. The new
implementation primarily differs from the former in that the asmprinter
doesn't make a zillion decisions about whether or not something will be
RIP relative or not.  Instead, those decisions are made by isel lowering
and propagated through to the asm printer.  To achieve this, we:

1. Represent RIP relative addresses by setting the base of the X86 addr
   mode to X86::RIP.
2. When ISel Lowering decides that it is safe to use RIP, it lowers to
   X86ISD::WrapperRIP.  When it is unsafe to use RIP, it lowers to
   X86ISD::Wrapper as before.
3. This removes isRIPRel from X86ISelAddressMode, representing it with
   a basereg of RIP instead.
4. The addressing mode matching logic in isel is greatly simplified.
5. The asmprinter is greatly simplified, notably the "NotRIPRel" predicate
   passed through various printoperand routines is gone now.
6. The various symbol printing routines in asmprinter now no longer infer
   when to emit (%rip), they just print the symbol.

I think this is a big improvement over the previous situation.  It does have
two small caveats though: 1. I implemented a horrible "no-rip" modifier for
the inline asm "P" constraint modifier.  This is a short term hack, there is
a much better, but more involved, solution.  2. I had to xfail an 
-aggressive-remat testcase because it isn't handling the use of RIP in the
constant-pool reading instruction.  This specific test is easy to fix without
-aggressive-remat, which I intend to do next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 04:16:01 +00:00
Chris Lattner
1873d0c225 When doing remat, don't consider uses of non-allocatable physregs. Patch
by Evan.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 04:06:41 +00:00
Evan Cheng
9cb9e6778c Renaming for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 02:26:13 +00:00
Chris Lattner
89da699092 Fix PR4466 by making fastisel set operand flags correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 01:31:51 +00:00
Chris Lattner
5b93ea1ca3 fix a typo that GCC should have caught that causes crashes with -view-*-dags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 00:57:02 +00:00
David Goodwin
8eba8e0ca3 Remove outdated comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 23:39:02 +00:00
David Goodwin
dcdaebc592 When possible, use "mvn ra, rb" instead of "eor ra, rb, -1" because mvn has a narrow version and eor(i) does not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 23:13:13 +00:00
Dan Gohman
667d787c0a Incorporate the insertion point into the key of SCEVExpander's CSE map.
This helps it avoid reusing an instruction that doesn't dominate all
of the users, in cases where the original instruction was inserted
before all of the users were known.  This may result in redundant
expansions of sub-expressions that depend on loop-unpredictable values
in some cases, however this isn't very common, and it primarily impacts
IndVarSimplify, so GVN can be expected to clean these up.

This eliminates the need for IndVarSimplify's FixUsesBeforeDefs,
which fixes several bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:46 +00:00
Devang Patel
acec7b35aa Remove unused routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:22 +00:00
David Greene
343dadbb36 Add feature flags for AVX and FMA and fix some SSE4A feature flag
initialization problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:46:54 +00:00
Dan Gohman
9a80b459ed Fix ScalarEvolution::getAddRecExpr's code which canonicalized the
nesting order of nested AddRec expressions to skip the transformation
if it would introduce an AddRec with operands not loop-invariant
with respect to its loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:36:20 +00:00
Dan Gohman
e890eead22 Fix SCEVAddRecExpr::isLoopInvariant to test if all of its operands
are loop invariant, not just the start operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:17:21 +00:00
Evan Cheng
2c2fb823b9 Add x86 support for 'n' inline asm modifier. This will be handled target independently as part of MC work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:00:19 +00:00
Chris Lattner
d8220e5794 simplify printing of MO_ExternalSymbol in a non-pcrel context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:47:27 +00:00
Owen Anderson
2af72d455b Privatize some data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:45:04 +00:00
Owen Anderson
afe0a083c1 Constify this value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:39:56 +00:00
Anton Korobeynikov
d49ea77cbc Split thumb-related stuff into separate classes.
Step 1: ARMInstructionInfo => {ARM,Thumb}InstructionInfo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:28:53 +00:00
Chris Lattner
c4233af200 add %rip to the GR64 register class. Lets avoid allocating it to anything though! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:25:00 +00:00
Chris Lattner
b903bed0fe Move all the TLS processing logic into isel, don't do it in asmprinter at all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:20:29 +00:00
Chris Lattner
ba8ef45d12 make sure to propagate operand flags in SelectTLSADDRAddr properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:18:37 +00:00
Chris Lattner
505e982040 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:14:05 +00:00
David Goodwin
24062ac5be Thumb-2 has CLZ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:47:43 +00:00
David Goodwin
7ce720b448 Use "adcs/sbcs" only when the carry-out is live, otherwise use "adc/sbc".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:45:56 +00:00
Owen Anderson
b41b5e0b2d Get rid of these cache variables, which are a holdover from the days when
we had multiple type planes and these lookups were expensive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:33:47 +00:00
Owen Anderson
a6184406b7 Make this const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:21:18 +00:00
Chris Lattner
03a597f2b7 minor cleanup/framework changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:00:05 +00:00
Owen Anderson
52132bf643 Privatize some variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 19:48:37 +00:00
Chris Lattner
41621a2700 move magic for PIC constantpool references from asmprinter to isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 19:22:52 +00:00
Chris Lattner
d212bb8ef2 implement DOTGraphTraits<SelectionDAG*>::getNodeLabel in terms of
SDNode::print_details to eliminate a ton of near-duplicate code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 19:06:10 +00:00
Chris Lattner
89ca575c31 use jump table operand flags in asm printer instead of "magic predicates"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 18:55:01 +00:00
Owen Anderson
cb73734247 Use atomic operations for accessing this global counter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 18:09:03 +00:00
David Goodwin
93d95bd2c3 ADC used to implement adde should use "adcs" opcode instead of "adc".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 18:07:25 +00:00
Owen Anderson
fdca74c567 Get rid of unnecessary global variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 16:46:15 +00:00
David Goodwin
83b3593478 Currently there is a pattern for the thumb-2 MOV 16-bit immediate instruction. That instruction cannot write the flags so it should use T2I instead of T2sI.
Also, added a pattern for the thumb-2 MOV of shifted immediate since that can encode immediates not encodable by the 16-bit immediate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 16:10:07 +00:00
Douglas Gregor
8947881444 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 15:37:00 +00:00
Owen Anderson
02b97355aa Fix compilation without pthreads.
Patch by Xerxes Ranby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 08:48:03 +00:00
Evan Cheng
2b51d51bc3 Simplify predicate CarryDefIsUsed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 06:10:18 +00:00
Chris Lattner
0b0deab464 fix a pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 05:56:49 +00:00
Chris Lattner
7bea038b3e dot graph viewing is apparently not using SDNode::print_details, this is bad,
but in the meantime lets print targetflags on node labels.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 05:55:43 +00:00
Chris Lattner
6ec66dba12 propagate target operand flags from dag nodes into MachineOperands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 05:52:14 +00:00
Chris Lattner
b8afeb99e9 propagate target operand flags through addressing mode selection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 05:51:45 +00:00
Chris Lattner
5202312d2e fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 05:39:02 +00:00
Nick Lewycky
b8b7347c10 Escape the name of the module since it comes from the file name and may include
invalid characters like backslashes on Windows. Patch by James Abbatiello!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 04:33:37 +00:00
Devang Patel
0f05d22a31 Let's ignore MDStrings also!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 02:26:12 +00:00
Daniel Dunbar
1c723b7145 Fix may-be-used-uninitialized warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 02:03:52 +00:00
Devang Patel
13e16b65dd Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:49:18 +00:00
Daniel Dunbar
6f8f6066fd Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:34:35 +00:00
Owen Anderson
1c7a848e54 Fix error in the Win32 implementation pointed out by Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:51:20 +00:00
Chris Lattner
55e7c82730 start adding logic in isel to determine asm printer semantics, step N of M.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:43:52 +00:00
Dan Gohman
e1047fbb97 Change this code to a form about which VC++ reportedly isn't unhappy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:35:12 +00:00