1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/include/llvm/Target
Arthur Eubanks ad84da6d6d Reland [X86] Codegen for preallocated
See https://reviews.llvm.org/D74651 for the preallocated IR constructs
and LangRef changes.

In X86TargetLowering::LowerCall(), if a call is preallocated, record
each argument's offset from the stack pointer and the total stack
adjustment. Associate the call Value with an integer index. Store the
info in X86MachineFunctionInfo with the integer index as the key.

This adds two new target independent ISDOpcodes and two new target
dependent Opcodes corresponding to @llvm.call.preallocated.{setup,arg}.

The setup ISelDAG node takes in a chain and outputs a chain and a
SrcValue of the preallocated call Value. It is lowered to a target
dependent node with the SrcValue replaced with the integer index key by
looking in X86MachineFunctionInfo. In
X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to an
%esp adjustment, the exact amount determined by looking in
X86MachineFunctionInfo with the integer index key.

The arg ISelDAG node takes in a chain, a SrcValue of the preallocated
call Value, and the arg index int constant. It produces a chain and the
pointer fo the arg. It is lowered to a target dependent node with the
SrcValue replaced with the integer index key by looking in
X86MachineFunctionInfo. In
X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to a
lea of the stack pointer plus an offset determined by looking in
X86MachineFunctionInfo with the integer index key.

Force any function containing a preallocated call to use the frame
pointer.

Does not yet handle a setup without a call, or a conditional call.
Does not yet handle musttail. That requires a LangRef change first.

Tried to look at all references to inalloca and see if they apply to
preallocated. I've made preallocated versions of tests testing inalloca
whenever possible and when they make sense (e.g. not alloca related,
inalloca edge cases).

Aside from the tests added here, I checked that this codegen produces
correct code for something like

```
struct A {
        A();
        A(A&&);
        ~A();
};

void bar() {
        foo(foo(foo(foo(foo(A(), 4), 5), 6), 7), 8);
}
```

by replacing the inalloca version of the .ll file with the appropriate
preallocated code. Running the executable produces the same results as
using the current inalloca implementation.

Reverted due to unexpectedly passing tests, added REQUIRES: asserts for reland.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77689
2020-05-20 11:25:44 -07:00
..
GlobalISel GlobalISel: Fold G_MUL x, 0, and G_*DIV 0, x 2020-05-18 18:08:26 -04:00
CodeGenCWrappers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
GenericOpcodes.td [GlobalISel] translate freeze to new generic G_FREEZE 2020-04-15 16:47:05 +02:00
Target.td Reland [X86] Codegen for preallocated 2020-05-20 11:25:44 -07:00
TargetCallingConv.td Reland [X86] Codegen for preallocated 2020-05-20 11:25:44 -07:00
TargetInstrPredicate.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TargetIntrinsicInfo.h TargetIntrinsicInfo.h - remove unnecessary Compiler.h include. NFC. 2020-05-19 09:28:13 +01:00
TargetItinerary.td [llvm] NFC: Fix trivial typo in rst and td files 2020-04-23 14:26:32 +09:00
TargetLoweringObjectFile.h TargetLoweringObjectFile.h - remove unnecessary includes. NFCI. 2020-05-19 09:28:13 +01:00
TargetMachine.h Reland D73534: [DebugInfo] Enable the debug entry values feature by default 2020-03-19 13:57:30 +01:00
TargetOptions.h TargetOptions.h - remove unused llvm::Module forward declaration. NFC. 2020-04-10 17:36:03 +01:00
TargetPfmCounters.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TargetSchedule.td [llvm] NFC: Fix trivial typo in rst and td files 2020-04-23 14:26:32 +09:00
TargetSelectionDAG.td [TableGen] Drop deprecated leading # operation (NOP) and replace ## with # 2020-04-25 16:26:45 -07:00