1 //=====-- SPUFrameLowering.h - SPU Frame Lowering stuff -*- C++ -*----========//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains CellSPU frame information that doesn't fit anywhere else
13 //===----------------------------------------------------------------------===//
15 #ifndef SPU_FRAMEINFO_H
16 #define SPU_FRAMEINFO_H
18 #include "SPURegisterInfo.h"
19 #include "llvm/Target/TargetFrameLowering.h"
20 #include "llvm/Target/TargetMachine.h"
25 class SPUFrameLowering: public TargetFrameLowering {
26 const SPUSubtarget &Subtarget;
27 std::pair<unsigned, int> LR[1];
30 SPUFrameLowering(const SPUSubtarget &sti);
32 //! Determine the frame's layour
33 void determineFrameLayout(MachineFunction &MF) const;
35 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
37 void emitPrologue(MachineFunction &MF) const;
38 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
40 //! Prediate: Target has dedicated frame pointer
41 bool hasFP(const MachineFunction &MF) const;
43 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
44 RegScavenger *RS = NULL) const;
46 //! Return a function's saved spill slots
48 For CellSPU, a function's saved spill slots is just the link register.
50 const std::pair<unsigned, int> *
51 getCalleeSaveSpillSlots(unsigned &NumEntries) const;
53 //! Stack slot size (16 bytes)
54 static int stackSlotSize() {
57 //! Maximum frame offset representable by a signed 10-bit integer
59 This is the maximum frame offset that can be expressed as a 10-bit
60 integer, used in D-form addresses.
62 static int maxFrameOffset() {
63 return ((1 << 9) - 1) * stackSlotSize();
65 //! Minimum frame offset representable by a signed 10-bit integer
66 static int minFrameOffset() {
67 return -(1 << 9) * stackSlotSize();
69 //! Minimum frame size (enough to spill LR + SP)
70 static int minStackSize() {
71 return (2 * stackSlotSize());
73 //! Convert frame index to stack offset
74 static int FItoStackOffset(int frame_index) {
75 return frame_index * stackSlotSize();