Commit Graph

467 Commits

Author SHA1 Message Date
Evan Cheng
a13fd108f2 AM2 can match 2^n +/- 1. e.g. ldr r3, [r2, r2, lsl #2]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35088 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 21:05:54 +00:00
Evan Cheng
961f879ed8 Zero is always a legal AM immediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35087 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 20:37:59 +00:00
Evan Cheng
e8308df0b9 Implement getTargetLowering() or else LSR won't be using ARM specific hooks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35077 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 01:20:42 +00:00
Evan Cheng
b01fad6d19 Updated TargetLowering LSR addressing mode hooks for ARM and Thumb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35075 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 23:30:29 +00:00
Evan Cheng
1a9da0d66c Minor stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35049 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 19:46:06 +00:00
Evan Cheng
44f4fca3c0 Add comments about LSR / ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35048 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 19:35:33 +00:00
Evan Cheng
2265b49193 Unfinished work and ideas related to register scavenger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35047 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 19:34:51 +00:00
Dale Johannesen
818c085232 apply comments from review of last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35045 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 19:18:59 +00:00
Dale Johannesen
a6bc6fc170 Add some observations from CoreGraphics benchmark. Remove register
scavenging todo item, since it is now implemented.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35044 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 17:58:17 +00:00
Evan Cheng
23a9570494 Implement inline asm modifier c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35035 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 22:42:46 +00:00
Evan Cheng
b582b1b1fc Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35030 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 21:59:30 +00:00
Evan Cheng
032953d747 Putting more constants which do not contain relocations into .literal{4|8|16}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35026 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 08:31:54 +00:00
Evan Cheng
bf822eb6a3 Change register allocation order to Dale's suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35021 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 02:56:40 +00:00
Evan Cheng
11788fde93 Bug fix. Not advancing the register scavenger iterator correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35020 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 02:55:08 +00:00
Evan Cheng
98ded765c2 For Darwin, put constant data into .const, .const_data, .literal{4|8|16}
sections.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35017 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 01:25:25 +00:00
Evan Cheng
603b83ebcd Only safe to use a call-clobbered or spilled callee-saved register as scratch register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35010 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 20:30:36 +00:00
Anton Korobeynikov
d0b82b301d Refactoring of formal parameter flags. Enable properly use of
zext/sext/aext stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35008 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 16:25:09 +00:00
Evan Cheng
cb20998b3f ARM always use register scavenger. No longer reserves R12.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34999 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 02:46:23 +00:00
Evan Cheng
0ea12ec848 Fix some brittle code. Watch out for cases where register scavenger is pointing to deleted instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 02:38:05 +00:00
Evan Cheng
3d06cf4584 Fix one more Thumb eliminateFrameIndex bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 00:12:18 +00:00
Evan Cheng
e6257632fc Register scavenging is now on by default for ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34987 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 22:02:53 +00:00
Evan Cheng
a90f3408b3 Make load / store optimizer use register scavenger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 21:59:20 +00:00
Evan Cheng
cc1c427266 Code clean up. Prepare to use register scavenger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34976 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 18:02:41 +00:00
Evan Cheng
140e33cfd1 Scavenge a register using the register scavenger when needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 10:03:56 +00:00
Anton Korobeynikov
1d9baccc9b Use new SDIselParamAttr enumeration. This removes "magick" constants
from formal attributes' flags processing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34963 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 08:12:33 +00:00
Lauro Ramos Venancio
6d7dd8ef46 Use init_array/fini_array sections for static contructors/destructors when the ABI is AAPCS.
Fix SingleSource/Regression/C/ConstructorDestructorAttributes test on arm-linux-gnueabi.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34931 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 17:59:58 +00:00
Dale Johannesen
9f8e50d4ed eliminate unnecessary reset of SP in epilog on darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 01:17:17 +00:00
Evan Cheng
c1c2de0ae7 Use a spilled free callee-saved register as scratch register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 08:57:52 +00:00
Evan Cheng
f49407b790 - Track which callee-saved registers are spilled.
- Some code clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34783 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 08:26:31 +00:00
Evan Cheng
cda067bad9 Switch from std::vector<bool> to BitVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34781 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 07:52:44 +00:00
Bill Wendling
f1d6006ad6 Get rid of verboten <iostream> include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 06:05:39 +00:00
Dale Johannesen
b71aa2b6ca Changes requested in review of last pass. Also pulled isThumb into a
member, instead of resetting in every function that uses it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34764 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 23:20:38 +00:00
Evan Cheng
ad78ef2154 Doh. ARM::PC is obvious a reserved register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34763 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 23:12:34 +00:00
Dale Johannesen
f1b214d3ca Add intelligence about where to break large blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 18:41:23 +00:00
Evan Cheng
36230cdda4 Make requiresRegisterScavenging determination on a per MachineFunction basis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34711 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 00:59:19 +00:00
Evan Cheng
41a4d562f7 Temporary: make R12 available in ARM mode if RegScavenger is being used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34709 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 00:22:44 +00:00
Evan Cheng
1b051fc6a4 Start making use of RegScavenger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34708 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 00:21:58 +00:00
Evan Cheng
5e6df4647e PEI now passes a RegScavenger ptr to eliminateFrameIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 00:21:17 +00:00
Evan Cheng
15991bf775 Minor tweak. Allocate r0 to r3 in reverse order, r3 is least likely to be livein to a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34701 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 23:03:55 +00:00
Evan Cheng
5ef9226f30 Let MRegisterInfo now owns RegScavenger; eliminateFrameIndex must preserve register kill info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 21:12:35 +00:00
Dale Johannesen
ce74de46dd cosmetic changes from review of last patch. obvious
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34598 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 18:31:31 +00:00
Dale Johannesen
598270a68d remove crediting of Evan Cheng and me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34568 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 01:42:36 +00:00
Dale Johannesen
99c49a4b94 Removed WaterListOffset, inserted BBOffsets. Remove TODO item about this
from README.
When no water available, use end of block if in range.  (More to do here.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34563 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 00:47:03 +00:00
Lauro Ramos Venancio
acdfa445ac bugfix: SP wasn't updated for varargs when frame pointer was eliminated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 21:53:48 +00:00
Lauro Ramos Venancio
600c383e5c Fix stack alignment in functions with varargs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34532 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 20:32:57 +00:00
Dale Johannesen
88e37ae366 rewrite of constant islands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34523 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 05:02:36 +00:00
Evan Cheng
04321f70f5 Added -march=thumb; removed -enable-thumb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 03:14:31 +00:00
Evan Cheng
ead7590581 Add option to turn on register scavenger; By default, spills kills the register being stored.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34514 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 01:09:11 +00:00
Jim Laskey
2ad9f17fee Simplify lowering and selection of exception ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34488 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-22 14:56:36 +00:00
Jim Laskey
62819f3144 Support to provide exception and selector registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34482 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 22:54:50 +00:00
Evan Cheng
b371f457b0 Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 21:49:54 +00:00
Reid Spencer
a284cbf667 For PR1207:
Revert patches that caused the problem. Evan, please investigate and reapply
when you've discovered the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34399 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 03:20:00 +00:00
Evan Cheng
eceada6728 Added getReservedRegs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-17 11:06:00 +00:00
Chris Lattner
d2b7cec527 Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34266 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-14 05:52:17 +00:00
Lauro Ramos Venancio
7501605988 Add space between // and the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34246 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 20:06:15 +00:00
Lauro Ramos Venancio
3630e78db9 Add ABI information to ARM subtarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34245 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 19:52:28 +00:00
Lauro Ramos Venancio
876eaf1135 According to ARM EABI, 8-bytes function arguments must be 8-bytes aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34241 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 14:07:13 +00:00
Evan Cheng
e03cff6812 These vectors are frequently large. Use std::vector instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-09 23:59:14 +00:00
Evan Cheng
c99ef085b9 Add reference counting to constantpool entries. Delete the unused ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34105 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-09 20:54:44 +00:00
Evan Cheng
bd8251a9a6 isLowRegister() expects input is a physical register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34013 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:44:33 +00:00
Evan Cheng
403e4a4725 Rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34011 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:24:09 +00:00
Evan Cheng
5ebd10e5ac If sp offset will be materialized in a register. Clear the offset field of str / ldr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34010 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:19:58 +00:00
Evan Cheng
8fdbe560a0 Get rid of references to iostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34009 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:18:32 +00:00
Evan Cheng
2ef02a220e New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34000 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 09:22:15 +00:00
Evan Cheng
8bed6c968f In thumb mode, R3 is reserved, but it can be live in to the function. If
that is the case, whenever we use it as a scratch register, save it to R12
first and then restore it after the use.
This is a temporary and truly horrible workaround!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33999 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 09:17:36 +00:00
Evan Cheng
1f253d6e97 Update
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 08:37:57 +00:00
Evan Cheng
7142f8755a - If fp (r7) is used to reference stack objects, use [r, r] address mode.
- If there is a dynamic alloca, in the epilogue, restore the value of sp
  using r7 - offset.
- Other bug fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 08:37:31 +00:00
Evan Cheng
a01faf4a7a eliminateFrameIndex() is even more complicated if frame ptr is used instead of SP when there are dynamic alloca's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33975 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 02:44:23 +00:00
Evan Cheng
8e59ea998f Spill / restore should avoid modifying the condition register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 00:06:56 +00:00
Evan Cheng
8c1a73ad3f Select add FI, c correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 09:11:20 +00:00
Evan Cheng
40984d7449 foldMemoryOperand() cannot fold tMOVrr sp into load / store in thumb mode. tLDRspi / tSTRspi cannot target / store high registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33958 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 06:13:29 +00:00
Evan Cheng
88b633165a eliminateFrameIndex() bug when frame pointer is used as base register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33945 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 00:23:31 +00:00
Evan Cheng
ad0e465889 - Store val, [sp, c] must be selected to tSTRsp.
- If c does not fit in the offset field, materialize sp + c into a register
  using tADDhirr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33944 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 00:22:06 +00:00
Evan Cheng
b38cba928e ARM callseq_end should have a input flag operand so it would be scheduled right after the call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33832 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-03 09:11:58 +00:00
Evan Cheng
fc4034259f Fix comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-03 08:53:01 +00:00
Evan Cheng
bd5d3dbdbe - Branch max. displacement calculation bug.
- Add debugging info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33811 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-03 02:08:34 +00:00
Lauro Ramos Venancio
4642ca6589 bugfix: SP isn't resetted when function has FP and there is no spills.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33800 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 23:08:40 +00:00
Evan Cheng
a21335dd76 Another thumb large stack offset codegen bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 21:08:39 +00:00
Evan Cheng
05cc424082 Use MBB.empty() instead of MBB.size() for speed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33789 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 19:09:19 +00:00
Evan Cheng
1dd6a606ad Watch out for empty BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33788 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 18:49:02 +00:00
Evan Cheng
f48ae3353e Ugh. Only meant to do this in thumb mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33780 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 08:58:48 +00:00
Chris Lattner
2d1222c060 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33778 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 04:36:46 +00:00
Evan Cheng
9a2ef9509e Fix a bug in getARMCMP (which translate CondCode to ARM specific CC) when the RHS is a constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 01:53:26 +00:00
Evan Cheng
b0636156ef Thumb does not have clz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33773 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 23:34:03 +00:00
Lauro Ramos Venancio
c33f674ca3 Define PrivateGlobalPrefix for ARM Linux. (Fix CodeGen/ARM/large_stack.ll)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33763 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 21:43:53 +00:00
Evan Cheng
556f33c6e2 Pasto. Lots of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33762 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 20:44:52 +00:00
Lauro Ramos Venancio
6f46e59d2a Fix .thumb_func directive on linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33759 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 18:25:34 +00:00
Evan Cheng
b43216ee4a - Off by one bugs in maximum displacement calculation / testing.
- In thumb mode, a new constpool island BB size should be 4 + 2 to
  compensate for the potential padding due to alignment requirement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33753 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 10:16:15 +00:00
Evan Cheng
e0c2b6b9a8 .set pc relative displacement bug: label should be moved down one instruction
to just before the add r1, pc:

Before:
        .set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
LPCRELL0:
        mov r1, #PCRELV0
        add r1, pc

Now:
        .set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
        mov r1, #PCRELV0
LPCRELL0:
        add r1, pc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 03:04:49 +00:00
Evan Cheng
736cefff85 Add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33743 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 02:46:20 +00:00
Evan Cheng
9312313a56 Also set alignment of stack-based structs to 4 in thumb mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33741 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 02:18:36 +00:00
Evan Cheng
9d945f78e5 Special epilogue for vararg functions. We cannot do a pop to pc because
there follows a sp increment for the va register save region. Instead issue
a separate pop to another register, increment sp, and then return:
        pop {r4, r5, r6, r7}
        pop {r3}
        add sp, #3 * 4
        bx r3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33739 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 01:49:46 +00:00
Evan Cheng
2021abe154 Pessmistically assume the .align 2 before the first constpool entry adds
two bytes padding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 01:09:47 +00:00
Evan Cheng
5b49ab9996 Possible JT improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 01:07:48 +00:00
Evan Cheng
3bf12d0460 Don't emit unnecessary .align directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33729 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 23:39:39 +00:00
Evan Cheng
a2e35588c6 Handle an interesting corner case: the constpool_entry being reference is two
instructions away, i.e. its address is equal to PC.
        %r0 = tLDRpci <cp#0>
        bx
        CONSTPOOL_ENTRY 0 <cp#0>, 4


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 23:35:18 +00:00
Evan Cheng
7588ad478a Don't want to add FramePtr to callee save spill list twice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 23:17:29 +00:00
Evan Cheng
3548006a29 Darwin ABI requires FP to point to stack slot of prev FP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33724 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 22:25:33 +00:00
Evan Cheng
11a065e599 Add entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33723 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 22:11:38 +00:00
Evan Cheng
0fa10515ee Thumb add sp, #imm requires the immediate value be multiple of 4. For now,
change preferred alignment of short, byte, bool to 4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33722 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 22:08:40 +00:00
Evan Cheng
86eb515359 Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33721 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 22:06:44 +00:00
Evan Cheng
3471b60e95 Thumb asm syntax does not want 's' suffix for flag setting opcodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33717 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 20:12:31 +00:00
Evan Cheng
c0dbec7e10 When determining whether a pc relative branch / load displacement fits in the
instruction field, adjust it for PC value (4 for thumb, 8 for arm).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33711 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 19:57:44 +00:00
Evan Cheng
a9b8b8d62c Some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 18:29:27 +00:00
Evan Cheng
934536dab2 ConstPool island bug: watch out for cases where UserMI is the last MI of the BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33706 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 18:19:07 +00:00
Lauro Ramos Venancio
b5b84f92bf ARM fix: Miscompilation when frame pointer can't be eliminated. Uninitialized frame pointer register is used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33703 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 13:12:46 +00:00
Evan Cheng
193f850880 Specify the right CC for comparison libcalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 09:30:58 +00:00
Evan Cheng
b6ab2547cb Observe -soft-float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33699 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 08:40:13 +00:00
Evan Cheng
0c61584d05 - Added Thumb constpool island support.
- Islands are inserted right after the user MI since thumb LDR cannot encode
  negative offset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33690 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 02:22:22 +00:00
Evan Cheng
36640905e1 During PEI, if the immediate value of sp + offset is too large (i.e. something
that would require > 3 instructions to materialize), load the immediate from a
constpool entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33667 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:01:46 +00:00
Evan Cheng
c60e76d139 - Fix codegen for pc relative constant (e.g. JT) in thumb mode:
.set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
LPCRELL0:
        add r1, pc, #PCRELV0
This is not legal since add r1, pc, #c requires the constant be a multiple of 4.
Do the following instead:
        .set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
LPCRELL0:
        mov r1, #PCRELV0
        add r1, pc

- In thumb mode, it's not possible to use .set generate a pc relative stub
  address. The stub is ARM code which is in a different section from the thumb
  code. Load the value from a constpool instead.
- Some asm printing clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:37:08 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Evan Cheng
ad1b9a503c Copy and paste bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33658 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:22:33 +00:00
Evan Cheng
b267ca17d1 Darwin -static should codegen static ctors / dtors to .constructor / .destructor sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:04:53 +00:00
Evan Cheng
c322a9ac14 Misseed thumb jumptable branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:03:06 +00:00
Evan Cheng
236f677e48 In thumb mode, round up stack frame size to multiple of 4 since add/sub
sp, imm instructions implicitly multiply the offset by 4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:57:02 +00:00
Evan Cheng
5b91c7f69a Thumb eliminateFrameIndex fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:36:01 +00:00
Evan Cheng
cea117d2de Change the operand orders to t_addrmode_s* to make it easier to morph
instructions that use these address modes to instructions that use
t_addrmode_sp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:35:32 +00:00
Evan Cheng
d1b2c1e88f - In thumb mode, if size of MachineFunction is >= 2048, force LR to be
spilled (if it is not already).
- If LR is spilled, use BL to implement far jumps. LR is not used as a GPR
  in thumb mode so it can be clobbered if it is properly spilled / restored
  in prologue / epilogue.
- If LR is force spilled but no far jump has been emitted, try undo'ing the
  spill by:
  push lr -> delete
  pop pc -> bx lr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 01:18:38 +00:00
Evan Cheng
225dfe973b Use BL to implement Thumb far jumps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 01:13:37 +00:00
Evan Cheng
29836c330f Factor GetInstSize() out of constpool island pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33644 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:45:17 +00:00
Nate Begeman
bcc5f36765 Finish off bug 680, allowing targets to custom lower frame and return
address nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33636 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:58:52 +00:00
Evan Cheng
24f7fb3267 Comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:23:02 +00:00
Evan Cheng
78268b9436 Remember if LR register has been spilled in this function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:22:24 +00:00
Anton Korobeynikov
b10308e440 Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-28 13:31:35 +00:00
Evan Cheng
198529aaf1 New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33569 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 02:33:22 +00:00
Evan Cheng
d85ac4d079 Thumb jumptable support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33568 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 02:29:45 +00:00
Evan Cheng
53d7dbafc3 Thumb add / sub with carry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33562 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 00:07:15 +00:00
Lauro Ramos Venancio
ea9fc58bbf Some asm directives fixes for ELF.
Now we can compile llvm-gcc on arm-linux-gnueabi!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33558 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 23:24:43 +00:00
Evan Cheng
3fdadfc9ab Represent tADDspi and tSUBspi as two-address instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33551 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 21:33:19 +00:00
Jim Laskey
44c3b9fdd4 Change the MachineDebugInfo to MachineModuleInfo to better reflect usage
for debugging and exception handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 21:22:28 +00:00
Lauro Ramos Venancio
fce1765a19 Fix Data16bitsDirective for ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33549 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 21:20:45 +00:00
Evan Cheng
43aeab68a6 Conditional branch being fixed up is not the last MI in the BB, there is a
unconditional branch following it. Simply invert the condition and swap
destinations if the conditional branch can reach the destination of the
unconditional branch:
beq L1
b   L2
=>
bne L2
b   L1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33548 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 20:38:26 +00:00
Lauro Ramos Venancio
1a92d941b3 If the constant pool value is a extern weak symbol, emit the weak reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 19:51:32 +00:00
Evan Cheng
b60c02e005 extload -> zextload
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 19:13:16 +00:00
Jim Laskey
1ee2925742 Make LABEL a builtin opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 14:34:52 +00:00
Evan Cheng
dd353b8ad7 SplitBlockBeforeInstr() insert a unconditional branch to the next BB. This
is unnecessary when we are fixing up a conditional branch since we will be
adding a unconditional branch to the destination of the original branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33517 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 02:02:39 +00:00
Evan Cheng
7755facd76 Need to scan the function for branches even if there aren't any constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33515 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 01:04:44 +00:00
Evan Cheng
a0bf794eb6 Forgot to update this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33512 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 23:31:04 +00:00
Evan Cheng
c285414988 Add comment, fix typo, reduce memory usage, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33510 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 23:18:59 +00:00
Evan Cheng
3df62bde9b I am an idiot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33509 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 23:18:16 +00:00
Lauro Ramos Venancio
b1cc052823 Fix elf object definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33502 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 20:11:04 +00:00
Evan Cheng
743fa032a7 Doh. Skip JT branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 19:43:52 +00:00
Evan Cheng
af5cbcb809 Added (preliminary) branch shortening capability to constantpool island pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33497 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 03:12:46 +00:00
Evan Cheng
6318ffd736 Getting rid uses of evil std::set<>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33496 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 03:07:27 +00:00
Evan Cheng
012f2d97b7 Use PC relative ldr to load from a constantpool in Thumb mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33484 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-24 08:53:17 +00:00
Evan Cheng
e966d6415c Allow [ fi#c, imm ] as ARM load / store addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-24 02:45:25 +00:00
Evan Cheng
79d4326b00 Various Thumb mode load / store isel bug fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-24 02:21:22 +00:00
Evan Cheng
c38f2bc3c2 - Reorg Thumb load / store instructions. Combine each rr and ri pair of
instructions into one (e.g. tLDRrr, tLDRri -> tLDR).
- Thumb ldrsb and ldrsh only have the [reg, reg] address format. If the
  address is not an add, materialize a 0 immediate into a register and use
  it as the offset field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-23 22:59:13 +00:00
Evan Cheng
a6f567c89e Darwin HiddenDirective is .private_extern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-23 19:06:03 +00:00