llvm-6502/include/llvm/Target
Evan Cheng ae16d6b972 SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR
to have single return block (at least getting there) for optimizations. This
is general goodness but it would prevent some tailcall optimizations.
One specific case is code like this:
int f1(void);
int f2(void);
int f3(void);
int f4(void);
int f5(void);
int f6(void);
int foo(int x) {
  switch(x) {
  case 1: return f1();
  case 2: return f2();
  case 3: return f3();
  case 4: return f4();
  case 5: return f5();
  case 6: return f6();
  }
}

=>
LBB0_2:                                 ## %sw.bb
  callq   _f1
  popq    %rbp
  ret
LBB0_3:                                 ## %sw.bb1
  callq   _f2
  popq    %rbp
  ret
LBB0_4:                                 ## %sw.bb3
  callq   _f3
  popq    %rbp
  ret

This patch teaches codegenprep to duplicate returns when the return value
is a phi and where the phi operands are produced by tail calls followed by
an unconditional branch:

sw.bb7:                                           ; preds = %entry
  %call8 = tail call i32 @f5() nounwind
  br label %return
sw.bb9:                                           ; preds = %entry
  %call10 = tail call i32 @f6() nounwind
  br label %return
return:
  %retval.0 = phi i32 [ %call10, %sw.bb9 ], [ %call8, %sw.bb7 ], ... [ 0, %entry ]
  ret i32 %retval.0

This allows codegen to generate better code like this:

LBB0_2:                                 ## %sw.bb
        jmp     _f1                     ## TAILCALL
LBB0_3:                                 ## %sw.bb1
        jmp     _f2                     ## TAILCALL
LBB0_4:                                 ## %sw.bb3
        jmp     _f3                     ## TAILCALL

rdar://9147433


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 17:17:39 +00:00
..
Mangler.h Remove std::string version of getNameWithPrefix. 2011-02-11 05:23:09 +00:00
SubtargetFeature.h Merge System into Support. 2010-11-29 18:16:10 +00:00
Target.td - Add "Bitcast" target instruction property for instructions which perform 2011-03-15 05:09:26 +00:00
TargetAsmBackend.h Add createELFObjectTargetWriter method to TargetAsmBackend, which enables construction of non-standard ELFObjectWriters that can be used in MCJIT. 2011-03-09 18:44:41 +00:00
TargetAsmInfo.h Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there. 2011-01-10 12:39:04 +00:00
TargetAsmLexer.h Moved InstallLexer() from the X86-specific AsmLexer 2010-01-31 02:28:18 +00:00
TargetAsmParser.h Introduce virtual ParseRegister method in TargetAsmParser. 2011-01-27 17:14:22 +00:00
TargetCallingConv.h Inside the calling convention logic LocVT is always a simple 2010-11-03 11:35:31 +00:00
TargetCallingConv.td Fix a couple of typos. 2010-08-27 21:38:11 +00:00
TargetData.h Add TargetData::fitsInLegalInteger(). 2011-03-16 00:13:28 +00:00
TargetELFWriterInfo.h Jim Asked us to move DataLayout on ARM back to the most specialized classes. Do 2010-10-03 18:59:45 +00:00
TargetFrameLowering.h Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there. 2011-01-10 12:39:04 +00:00
TargetInstrDesc.h - Add "Bitcast" target instruction property for instructions which perform 2011-03-15 05:09:26 +00:00
TargetInstrInfo.h Missing "virtual" keyword. Jakob's review. 2011-03-05 08:39:45 +00:00
TargetInstrItineraries.h Various bits of framework needed for precise machine-level selection 2010-12-24 05:03:26 +00:00
TargetIntrinsicInfo.h Reintroduce support for overloading target intrinsics 2009-11-05 03:19:08 +00:00
TargetJITInfo.h Merge System into Support. 2010-11-29 18:16:10 +00:00
TargetLibraryInfo.h Optimize fprintf -> iprintf if there are no floating point arguments 2011-03-03 14:20:22 +00:00
TargetLowering.h SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR 2011-03-19 17:17:39 +00:00
TargetLoweringObjectFile.h Delay the creation of eh_frame so that the user can change the defaults. 2011-01-23 05:43:40 +00:00
TargetMachine.h Beginnings of MC-JIT code generation. 2011-03-18 22:48:41 +00:00
TargetOpcodes.h Rename DBG_LABEL PROLOG_LABEL, because it's only used during prolog emission and 2010-07-16 22:20:36 +00:00
TargetOptions.h Grammar. 2010-07-29 18:11:28 +00:00
TargetRegisterInfo.h Re-commit 127368 and 127371. They are exonerated. 2011-03-10 00:16:32 +00:00
TargetRegistry.h Add support for the --noexecstack option. 2011-01-23 17:55:27 +00:00
TargetSchedule.td Comments about operand cycles and pipeline forwarding pathes. 2010-09-30 22:01:50 +00:00
TargetSelect.h Add InitializeNativeAsmParser function. 2011-03-09 17:25:46 +00:00
TargetSelectionDAG.td [AVX] Add INSERT_SUBVECTOR and support it on x86. This provides a 2011-01-26 19:13:22 +00:00
TargetSelectionDAGInfo.h reimplement memcpy/memmove/memset lowering to use MachinePointerInfo 2010-09-21 05:40:29 +00:00
TargetSubtarget.h Allow target to specify regclass for which antideps will only be broken along the critical path. 2009-11-13 19:52:48 +00:00