llvm-6502/include/llvm/Target
Tim Northover d113448c1d Refactor isInTailCallPosition handling
This change came about primarily because of two issues in the existing code.
Niether of:

define i64 @test1(i64 %val) {
  %in = trunc i64 %val to i32
  tail call i32 @ret32(i32 returned %in)
  ret i64 %val
}

define i64 @test2(i64 %val) {
  tail call i32 @ret32(i32 returned undef)
  ret i32 42
}

should be tail calls, and the function sameNoopInput is responsible. The main
problem is that it is completely symmetric in the "tail call" and "ret" value,
but in reality different things are allowed on each side.

For these cases:
1. Any truncation should lead to a larger value being generated by "tail call"
   than needed by "ret".
2. Undef should only be allowed as a source for ret, not as a result of the
   call.

Along the way I noticed that a mismatch between what this function treats as a
valid truncation and what the backends see can lead to invalid calls as well
(see x86-32 test case).

This patch refactors the code so that instead of being based primarily on
values which it recurses into when necessary, it starts by inspecting the type
and considers each fundamental slot that the backend will see in turn. For
example, given a pathological function that returned {{}, {{}, i32, {}}, i32}
we would consider each "real" i32 in turn, and ask if it passes through
unchanged. This is much closer to what the backend sees as a result of
ComputeValueVTs.

Aside from the bug fixes, this eliminates the recursion that's going on and, I
believe, makes the bulk of the code significantly easier to understand. The
trade-off is the nasty iterators needed to find the real types inside a
returned value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187787 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-06 09:12:35 +00:00
..
CostTable.h Moving Cost Tables up to share with other targets 2013-01-24 23:01:00 +00:00
Mangler.h Use proper section suffix for COFF weak symbols 2013-07-29 13:58:39 +00:00
Target.td Moving definition of MnemonicContainsDot field from class Instruction to class AsmParser as suggested. 2013-08-01 09:25:27 +00:00
TargetCallingConv.h Remove unused, undefined ArgFlagsTy::getArgFlagsString; add a comment about 'returned' 2013-04-21 18:05:20 +00:00
TargetCallingConv.td Add TableGen support for callee saved registers. 2012-01-17 22:46:58 +00:00
TargetFrameLowering.h [SystemZ] Clean up register scavenging code 2013-07-05 12:55:00 +00:00
TargetInstrInfo.h [SystemZ] Remove no-op MVCs 2013-07-05 14:38:48 +00:00
TargetIntrinsicInfo.h Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-17 06:59:23 +00:00
TargetItinerary.td I'm introducing a new machine model to simultaneously allow simple 2012-07-07 04:00:00 +00:00
TargetJITInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
TargetLibraryInfo.h Treat nothrow forms of ::operator delete and ::operator delete[] as 2013-07-21 23:11:42 +00:00
TargetLowering.h Refactor isInTailCallPosition handling 2013-08-06 09:12:35 +00:00
TargetLoweringObjectFile.h [DebugInfo] Allow getDebugThreadLocalSymbol to return MCExpr 2013-07-02 18:47:09 +00:00
TargetMachine.h Directly access objects which may change during compilation. 2013-06-17 20:41:25 +00:00
TargetOpcodes.h Add a new optimization pass: Stack Coloring, that merges disjoint static allocations (allocas). Allocas are known to be 2012-09-06 09:17:37 +00:00
TargetOptions.h Use function attributes to indicate that we don't want to realign the stack. 2013-08-01 21:42:05 +00:00
TargetRegisterInfo.h Add TargetRegisterInfo::getCoveringLanes(). 2013-05-16 18:03:08 +00:00
TargetSchedule.td Support BufferSize on ProcResGroup for unified MOp schedulers. 2013-06-15 04:50:06 +00:00
TargetSelectionDAG.td Create an FPOW SDNode opcode def in the target independent .td file rather than in a specific backend. 2013-05-22 06:36:09 +00:00
TargetSelectionDAGInfo.h Track IR ordering of SelectionDAG nodes 2/4. 2013-05-25 02:42:55 +00:00
TargetSubtargetInfo.h Use the 'target-features' and 'target-cpu' attributes to reset the subtarget features. 2013-02-15 22:31:27 +00:00