forked from OSchip/llvm-project
8a88755610
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 |
||
---|---|---|
.. | ||
ArgumentPromotion | ||
IPConstantProp | ||
reduced | ||
align.ll | ||
alwaysinline.ll | ||
callbacks.ll | ||
dereferenceable-1.ll | ||
dereferenceable-2.ll | ||
heap_to_stack.ll | ||
internal-noalias.ll | ||
liveness.ll | ||
liveness_chains.ll | ||
lvi-after-jumpthreading.ll | ||
lvi-for-ashr.ll | ||
memory_locations.ll | ||
misc.ll | ||
misc_crash.ll | ||
new_attributes.ll | ||
noalias.ll | ||
nocapture-1.ll | ||
nocapture-2.ll | ||
nofree.ll | ||
nonnull.ll | ||
norecurse.ll | ||
noreturn.ll | ||
noreturn_async.ll | ||
noreturn_sync.ll | ||
nosync.ll | ||
nounwind.ll | ||
range.ll | ||
read_write_returned_arguments_scc.ll | ||
readattrs.ll | ||
returned.ll | ||
undefined_behavior.ll | ||
value-simplify.ll | ||
willreturn.ll | ||
wrapper.ll |