From 1690f1d77d1a6a9016279df3a94dbbf68a4bd7a6 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 10 Dec 2002 13:07:12 +0000 Subject: [PATCH] This file provides the function DemoteRegToStack(), which takes a virtual register computed by an Instruction& X and replaces it with a slot in the stack frame, allocated via alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4963 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../llvm/Transforms/Utils/DemoteRegToStack.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/llvm/Transforms/Utils/DemoteRegToStack.h diff --git a/include/llvm/Transforms/Utils/DemoteRegToStack.h b/include/llvm/Transforms/Utils/DemoteRegToStack.h new file mode 100644 index 00000000000..915a19f1125 --- /dev/null +++ b/include/llvm/Transforms/Utils/DemoteRegToStack.h @@ -0,0 +1,21 @@ +//===- DemoteRegToStack.h - Move a virtual reg. to stack --------*- C++ -*-===// +// This file provides the function: +// AllocaInst* DemoteRegToStack(Instruction& X): +// +// This function takes a virtual register computed by an +// Instruction& X and replaces it with a slot in the stack frame, +// allocated via alloca. It has to: +// (1) Identify all Phi operations that have X as an operand and +// transitively other Phis that use such Phis; +// (2) Store all values merged with X via Phi operations to the stack slot; +// (3) Load the value from the stack slot just before any use of X or any +// of the Phis that were eliminated; and +// (4) Delete X and all the Phis, which should all now be dead. +// +// Returns the pointer to the alloca inserted to create a stack slot for X. +//---------------------------------------------------------------------------- + +class Instruction; +class AllocaInst; + +extern AllocaInst* DemoteRegToStack(Instruction& X);