Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- PPCMachineFunctionInfo.h - Private data used for PowerPC --*- C++ -*-=// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by James M. Laskey and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares the PowerPC specific subclass of MachineFunctionInfo. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef PPC_MACHINE_FUNCTION_INFO_H |
| 15 | #define PPC_MACHINE_FUNCTION_INFO_H |
| 16 | |
| 17 | #include "llvm/CodeGen/MachineFunction.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | /// PPCFunctionInfo - This class is derived from MachineFunction private |
| 22 | /// PowerPC target-specific information for each MachineFunction. |
| 23 | class PPCFunctionInfo : public MachineFunctionInfo { |
| 24 | private: |
| 25 | /// FramePointerSaveIndex - Frame index of where the old frame pointer is |
| 26 | /// stored. Also used as an anchor for instructions that need to be altered |
| 27 | /// when using frame pointers (dyna_add, dyna_sub.) |
| 28 | int FramePointerSaveIndex; |
| 29 | |
| 30 | /// UsesLR - Indicates whether LR is used in the current function. |
| 31 | /// |
| 32 | bool UsesLR; |
| 33 | |
| 34 | public: |
| 35 | PPCFunctionInfo(MachineFunction& MF) |
| 36 | : FramePointerSaveIndex(0) |
| 37 | {} |
| 38 | |
| 39 | int getFramePointerSaveIndex() const { return FramePointerSaveIndex; } |
| 40 | void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; } |
| 41 | |
Chris Lattner | a4698f2 | 2007-12-08 06:39:11 +0000 | [diff] [blame^] | 42 | /// UsesLR - This is set when the prolog/epilog inserter does its initial scan |
| 43 | /// of the function, it is true if the LR/LR8 register is ever explicitly |
| 44 | /// accessed/clobbered in the machine function (e.g. by calls and movpctolr, |
| 45 | /// which is used in PIC generation). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 46 | void setUsesLR(bool U) { UsesLR = U; } |
Chris Lattner | a4698f2 | 2007-12-08 06:39:11 +0000 | [diff] [blame^] | 47 | bool usesLR() const { return UsesLR; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 48 | |
| 49 | }; |
| 50 | |
| 51 | } // end of namespace llvm |
| 52 | |
| 53 | |
| 54 | #endif |