blob: 8ce8450a65bea6ae2d71ef1e827a6dafb8815022 [file] [log] [blame]
Scott Michel266bc8f2007-12-04 22:23:35 +00001//===-- SPUFrameInfo.h - Top-level interface for Cell SPU Target -*- C++ -*-==//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by a team from the Computer Systems Research
Scott Michel2466c372007-12-05 01:40:25 +00006// Department at The Aerospace Corporation and is distributed under the
7// University of Illinois Open Source License. See LICENSE.TXT for details.
Scott Michel266bc8f2007-12-04 22:23:35 +00008//
9//===----------------------------------------------------------------------===//
10//
11// This file contains CellSPU frame information that doesn't fit anywhere else
12// cleanly...
13//
14//===----------------------------------------------------------------------===//
15
16#if !defined(SPUFRAMEINFO_H)
17
18#include "llvm/Target/TargetFrameInfo.h"
19#include "llvm/Target/TargetMachine.h"
20#include "SPURegisterInfo.h"
21
22namespace llvm {
23 class SPUFrameInfo: public TargetFrameInfo {
24 const TargetMachine &TM;
25 std::pair<unsigned, int> LR[1];
26
27 public:
28 SPUFrameInfo(const TargetMachine &tm);
29
30 //! Return a function's saved spill slots
31 /*!
32 For CellSPU, a function's saved spill slots is just the link register.
33 */
34 const std::pair<unsigned, int> *
35 getCalleeSaveSpillSlots(unsigned &NumEntries) const;
36
37 //! Stack slot size (16 bytes)
38 static const int stackSlotSize() {
39 return 16;
40 }
41 //! Maximum frame offset representable by a signed 10-bit integer
42 /*!
43 This is the maximum frame offset that can be expressed as a 10-bit
44 integer, used in D-form addresses.
45 */
46 static const int maxFrameOffset() {
47 return ((1 << 9) - 1) * stackSlotSize();
48 }
49 //! Minimum frame offset representable by a signed 10-bit integer
50 static const int minFrameOffset() {
51 return -(1 << 9) * stackSlotSize();
52 }
53 //! Minimum frame size (enough to spill LR + SP)
54 static const int minStackSize() {
55 return (2 * stackSlotSize());
56 }
57 //! Frame size required to spill all registers plus frame info
58 static const int fullSpillSize() {
59 return (SPURegisterInfo::getNumArgRegs() * stackSlotSize());
60 }
61 //! Number of instructions required to overcome hint-for-branch latency
62 /*!
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.
68 */
69 static const int branchHintPenalty() {
70 return 6;
71 }
72 };
73}
74
75#define SPUFRAMEINFO_H 1
76#endif