diff options
| author | Reid Kleckner <reid@kleckner.net> | 2015-01-13 00:48:10 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2015-01-13 00:48:10 +0000 |
| commit | e9b893187333ca069b5aed697ad784865e42f79f (patch) | |
| tree | e17ad1b3279b4a6383370b0739b862f1b0635790 /llvm/lib/CodeGen/PrologEpilogInserter.cpp | |
| parent | 845755c4bb6c55eca84700060de706331ba77a71 (diff) | |
| download | llvm-e9b893187333ca069b5aed697ad784865e42f79f.zip llvm-e9b893187333ca069b5aed697ad784865e42f79f.tar.gz llvm-e9b893187333ca069b5aed697ad784865e42f79f.tar.bz2 | |
Add the llvm.frameallocate and llvm.recoverframeallocation intrinsics
These intrinsics allow multiple functions to share a single stack
allocation from one function's call frame. The function with the
allocation may only perform one allocation, and it must be in the entry
block.
Functions accessing the allocation call llvm.recoverframeallocation with
the function whose frame they are accessing and a frame pointer from an
active call frame of that function.
These intrinsics are very difficult to inline correctly, so the
intention is that they be introduced rarely, or at least very late
during EH preparation.
Reviewers: echristo, andrew.w.kaylor
Differential Revision: http://reviews.llvm.org/D6493
llvm-svn: 225746
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index f5f32ab..385e5a3 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -817,6 +817,17 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn, continue; } + // Frame allocations are target independent. Simply swap the index with + // the offset. + if (MI->getOpcode() == TargetOpcode::FRAME_ALLOC) { + assert(TFI->hasFP(Fn) && "frame alloc requires FP"); + MachineOperand &FI = MI->getOperand(i); + unsigned Reg; + int FrameOffset = TFI->getFrameIndexReference(Fn, FI.getIndex(), Reg); + FI.ChangeToImmediate(FrameOffset); + continue; + } + // Some instructions (e.g. inline asm instructions) can have // multiple frame indices and/or cause eliminateFrameIndex // to insert more than one instruction. We need the register |
