Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / Transforms / Utils / DemoteRegToStack.h
1 //===- DemoteRegToStack.h - Move a virtual reg. to stack --------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides the function:
11 //     AllocaInst* DemoteRegToStack(Instruction& X):
12 //
13 // This function takes a virtual register computed by an
14 // Instruction& X and replaces it with a slot in the stack frame,
15 // allocated via alloca.  It has to:
16 // (1) Identify all Phi operations that have X as an operand and
17 //     transitively other Phis that use such Phis; 
18 // (2) Store all values merged with X via Phi operations to the stack slot;
19 // (3) Load the value from the stack slot just before any use of X or any
20 //     of the Phis that were eliminated; and
21 // (4) Delete X and all the Phis, which should all now be dead.
22 //
23 // Returns the pointer to the alloca inserted to create a stack slot for X.
24 //
25 //===----------------------------------------------------------------------===//
26
27 class Instruction;
28 class AllocaInst;
29
30 AllocaInst *DemoteRegToStack(Instruction &X);