1 //===-- SPUFrameInfo.h - Top-level interface for Cell SPU Target -*- 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 #if !defined(SPUFRAMEINFO_H)
17 #include "llvm/Target/TargetFrameInfo.h"
18 #include "llvm/Target/TargetMachine.h"
19 #include "SPURegisterInfo.h"
22 class SPUFrameInfo
: public TargetFrameInfo
{
23 const TargetMachine
&TM
;
24 std::pair
<unsigned, int> LR
[1];
27 SPUFrameInfo(const TargetMachine
&tm
);
29 //! Return a function's saved spill slots
31 For CellSPU, a function's saved spill slots is just the link register.
33 const std::pair
<unsigned, int> *
34 getCalleeSaveSpillSlots(unsigned &NumEntries
) const;
36 //! Stack slot size (16 bytes)
37 static int stackSlotSize() {
40 //! Maximum frame offset representable by a signed 10-bit integer
42 This is the maximum frame offset that can be expressed as a 10-bit
43 integer, used in D-form addresses.
45 static int maxFrameOffset() {
46 return ((1 << 9) - 1) * stackSlotSize();
48 //! Minimum frame offset representable by a signed 10-bit integer
49 static int minFrameOffset() {
50 return -(1 << 9) * stackSlotSize();
52 //! Minimum frame size (enough to spill LR + SP)
53 static int minStackSize() {
54 return (2 * stackSlotSize());
56 //! Convert frame index to stack offset
57 static int FItoStackOffset(int frame_index
) {
58 return frame_index
* stackSlotSize();
60 //! Number of instructions required to overcome hint-for-branch latency
62 HBR (hint-for-branch) instructions can be inserted when, for example,
63 we know that a given function is going to be called, such as printf(),
64 in the control flow graph. HBRs are only inserted if a sufficient number
65 of instructions occurs between the HBR and the target. Currently, HBRs
66 take 6 cycles, ergo, the magic number 6.
68 static int branchHintPenalty() {
74 #define SPUFRAMEINFO_H 1