[all-commits] [llvm/llvm-project] 810567: [X86] Codegen for preallocated
aeubanks via All-commits
all-commits at lists.llvm.org
Wed May 20 09:27:07 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 810567dc691a57c8c13fef06368d7549f7d9c064
https://github.com/llvm/llvm-project/commit/810567dc691a57c8c13fef06368d7549f7d9c064
Author: Arthur Eubanks <aeubanks at google.com>
Date: 2020-05-20 (Wed, 20 May 2020)
Changed paths:
M llvm/include/llvm/CodeGen/ISDOpcodes.h
M llvm/include/llvm/CodeGen/TargetCallingConv.h
M llvm/include/llvm/CodeGen/TargetLowering.h
M llvm/include/llvm/IR/Argument.h
M llvm/include/llvm/IR/Attributes.h
M llvm/include/llvm/IR/InstrTypes.h
M llvm/include/llvm/Support/TargetOpcodes.def
M llvm/include/llvm/Target/Target.td
M llvm/include/llvm/Target/TargetCallingConv.td
M llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
M llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/lib/IR/Attributes.cpp
M llvm/lib/IR/Function.cpp
M llvm/lib/Target/X86/X86CallingConv.td
M llvm/lib/Target/X86/X86FastISel.cpp
M llvm/lib/Target/X86/X86FrameLowering.cpp
M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/lib/Target/X86/X86MachineFunctionInfo.h
M llvm/lib/Target/X86/X86RegisterInfo.cpp
M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
M llvm/lib/Transforms/IPO/Attributor.cpp
M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
M llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
M llvm/lib/Transforms/IPO/GlobalOpt.cpp
M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
M llvm/test/CodeGen/X86/arg-copy-elide.ll
M llvm/test/CodeGen/X86/musttail-indirect.ll
M llvm/test/CodeGen/X86/musttail-thiscall.ll
A llvm/test/CodeGen/X86/preallocated-nocall.ll
A llvm/test/CodeGen/X86/preallocated-x64.ll
A llvm/test/CodeGen/X86/preallocated.ll
M llvm/test/CodeGen/X86/shrink-wrap-chkstk.ll
M llvm/test/CodeGen/X86/tail-call-mutable-memarg.ll
M llvm/test/Transforms/Attributor/value-simplify.ll
M llvm/test/Transforms/DeadArgElim/keepalive.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/simple-todo.ll
M llvm/test/Transforms/DeadStoreElimination/simple.ll
M llvm/test/Transforms/FunctionAttrs/readattrs.ll
M llvm/test/Transforms/GlobalOpt/fastcc.ll
A llvm/test/Transforms/InstCombine/call-cast-target-preallocated.ll
Log Message:
-----------
[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.
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77689
More information about the All-commits
mailing list