Commit Graph

42 Commits

Author SHA1 Message Date
Dan Gohman f9bbcd1afd Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.

This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.

This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.

llvm-svn: 78142
2009-08-05 01:29:28 +00:00
Chris Lattner 5e693ed07b Rip all of the global variable lowering logic out of TargetAsmInfo. Since
it is highly specific to the object file that will be generated in the end,
this introduces a new TargetLoweringObjectFile interface that is implemented
for each of ELF/MachO/COFF/Alpha/PIC16 and XCore.

Though still is still a brutal and ugly refactoring, this is a major step
towards goodness.

This patch also:
1. fixes a bunch of dangling pointer problems in the PIC16 backend.
2. disables the TargetLowering copy ctor which PIC16 was accidentally using.
3. gets us closer to xcore having its own crazy target section flags and
   pic16 not having to shadow sections with its own objects.
4. fixes wierdness where ELF targets would set CStringSection but not
   CStringSection_.  Factor the code better.
5. fixes some bugs in string lowering on ELF targets.

llvm-svn: 77294
2009-07-28 03:13:23 +00:00
Owen Anderson 47db941fd3 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Eli Friedman fab6cbe6cd Oops, accidentally set a legal operation to expand.
llvm-svn: 76165
2009-07-17 07:34:23 +00:00
Eli Friedman 6a60a66b2b Expand misc operations from test/CodeGen/Generic.
llvm-svn: 76163
2009-07-17 07:28:06 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Owen Anderson 0504e0a222 Thread LLVMContext through MVT and related parts of SDISel.
llvm-svn: 75153
2009-07-09 17:57:24 +00:00
Torok Edwin fb8d6d5b58 Implement changes from Chris's feedback.
Finish converting lib/Target.

llvm-svn: 75043
2009-07-08 20:53:28 +00:00
Torok Edwin fa04002254 Convert more abort() calls to llvm_report_error().
Also remove trailing semicolon.

llvm-svn: 75027
2009-07-08 19:04:27 +00:00
Bill Wendling 512ff7353e Update comments to make it clear that the function alignment is the Log2 of the
bytes and not bytes.

llvm-svn: 74624
2009-07-01 18:50:55 +00:00
Bill Wendling 31ceb1bcba 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
Anton Korobeynikov 6de08cd093 Mark rotl/rotr as expand. This generates pretty ugly code, but this is better than nothing.
llvm-svn: 71976
2009-05-17 10:16:28 +00:00
Anton Korobeynikov 6b5523aec2 Typo
llvm-svn: 71975
2009-05-17 10:15:22 +00:00
Anton Korobeynikov ea618dd0ba Allow 8 bit select in custom inserter
llvm-svn: 71239
2009-05-08 18:51:21 +00:00
Anton Korobeynikov 1484cfe945 Expand UREM / SREM into libcalls
llvm-svn: 71236
2009-05-08 18:50:41 +00:00
Anton Korobeynikov 47fcd72e24 Make handling of conditional stuff much more straightforward
llvm-svn: 70767
2009-05-03 13:19:09 +00:00
Anton Korobeynikov eb2152f753 Expand divisions into libcalls
llvm-svn: 70765
2009-05-03 13:18:33 +00:00
Anton Korobeynikov 29747e9c26 Custom lower SIGN_EXTEND
llvm-svn: 70763
2009-05-03 13:17:49 +00:00
Anton Korobeynikov f3a6bc8562 Add 8bit shifts
llvm-svn: 70759
2009-05-03 13:16:37 +00:00
Anton Korobeynikov 61763b532a Handle logical shift right (at least I hope so :) )
llvm-svn: 70758
2009-05-03 13:16:17 +00:00
Anton Korobeynikov e31559576f Expand all sorts of indirect branches
llvm-svn: 70755
2009-05-03 13:15:40 +00:00
Anton Korobeynikov ba0e81d4b2 Properly handle ExternalSymbol's
llvm-svn: 70752
2009-05-03 13:14:46 +00:00
Anton Korobeynikov de60d1caef Expand muls (all mulls!) to libcalls for now
llvm-svn: 70751
2009-05-03 13:14:25 +00:00
Anton Korobeynikov a3f7a83ad8 Add left shift
llvm-svn: 70747
2009-05-03 13:13:17 +00:00
Anton Korobeynikov b6321e15f7 Lower select with custom inserted and make condjumps generic
llvm-svn: 70744
2009-05-03 13:12:23 +00:00
Anton Korobeynikov 962720129d Add first draft for conditions, conditional branches, etc
llvm-svn: 70743
2009-05-03 13:12:06 +00:00
Anton Korobeynikov 7212c15e70 Small tweaking
llvm-svn: 70741
2009-05-03 13:11:35 +00:00
Anton Korobeynikov cfc97056e7 Add lowering for global address nodes. Not pretty efficient though.
llvm-svn: 70730
2009-05-03 13:08:33 +00:00
Anton Korobeynikov ec3f0b3f9d Add call frame setup instruction elimination and lowerid for bunch of call-related stuff.
llvm-svn: 70728
2009-05-03 13:07:54 +00:00
Anton Korobeynikov 5613510c81 Add CALL lowering.
llvm-svn: 70727
2009-05-03 13:07:31 +00:00
Anton Korobeynikov ed1c3dfa0f Add normal and trunc stores
llvm-svn: 70724
2009-05-03 13:06:26 +00:00
Anton Korobeynikov 31ecd23a9e Basic support for mem=>reg moves
llvm-svn: 70723
2009-05-03 13:06:03 +00:00
Anton Korobeynikov b638fb10f5 Add pattern for OR
llvm-svn: 70720
2009-05-03 13:05:00 +00:00
Anton Korobeynikov e32c817d2c Cleanup
llvm-svn: 70716
2009-05-03 13:03:50 +00:00
Anton Korobeynikov 15a515b1af Add dummy lowering for shifts
llvm-svn: 70715
2009-05-03 13:03:33 +00:00
Anton Korobeynikov 55a085b539 We don't have any div at all - thus mark it as expensive
llvm-svn: 70714
2009-05-03 13:03:14 +00:00
Anton Korobeynikov d7afd69e3b Add code enough for emission of reg-reg and reg-imm moves. This allows us to compile "ret i16 0" properly!
llvm-svn: 70710
2009-05-03 13:02:04 +00:00
Anton Korobeynikov c10f98ace3 Provide set of reserved registers
llvm-svn: 70704
2009-05-03 13:00:11 +00:00
Anton Korobeynikov 7bfc3ea2ee Add proper ISD::RET lowering
llvm-svn: 70703
2009-05-03 12:59:50 +00:00
Anton Korobeynikov 3849be6ca1 Add first draft of MSP430 calling convention stuff and draft of ISD::FORMAL_ARGUMENTS node lowering.
llvm-svn: 70702
2009-05-03 12:59:33 +00:00
Anton Korobeynikov 101380015c Dummy MSP430 backend
llvm-svn: 70694
2009-05-03 12:57:15 +00:00