1 //===-- SPUFrameInfo.h - Top-level interface for Cell SPU Target -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by a team from the Computer Systems Research
6 // Department at The Aerospace Corporation and is distributed under the
7 // University of Illinois Open Source License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 // This file contains CellSPU frame information that doesn't fit anywhere else
14 //===----------------------------------------------------------------------===//
16 #if !defined(SPUFRAMEINFO_H)
18 #include "llvm/Target/TargetFrameInfo.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include "SPURegisterInfo.h"
23 class SPUFrameInfo: public TargetFrameInfo {
24 const TargetMachine &TM;
25 std::pair<unsigned, int> LR[1];
28 SPUFrameInfo(const TargetMachine &tm);
30 //! Return a function's saved spill slots
32 For CellSPU, a function's saved spill slots is just the link register.
34 const std::pair<unsigned, int> *
35 getCalleeSaveSpillSlots(unsigned &NumEntries) const;
37 //! Stack slot size (16 bytes)
38 static const int stackSlotSize() {
41 //! Maximum frame offset representable by a signed 10-bit integer
43 This is the maximum frame offset that can be expressed as a 10-bit
44 integer, used in D-form addresses.
46 static const int maxFrameOffset() {
47 return ((1 << 9) - 1) * stackSlotSize();
49 //! Minimum frame offset representable by a signed 10-bit integer
50 static const int minFrameOffset() {
51 return -(1 << 9) * stackSlotSize();
53 //! Minimum frame size (enough to spill LR + SP)
54 static const int minStackSize() {
55 return (2 * stackSlotSize());
57 //! Frame size required to spill all registers plus frame info
58 static const int fullSpillSize() {
59 return (SPURegisterInfo::getNumArgRegs() * stackSlotSize());
61 //! Number of instructions required to overcome hint-for-branch latency
63 HBR (hint-for-branch) instructions can be inserted when, for example,
64 we know that a given function is going to be called, such as printf(),
65 in the control flow graph. HBRs are only inserted if a sufficient number
66 of instructions occurs between the HBR and the target. Currently, HBRs
67 take 6 cycles, ergo, the magic number 6.
69 static const int branchHintPenalty() {
75 #define SPUFRAMEINFO_H 1