blob: 01e6578a352fd118423409b80312186444c667bd [file] [log] [blame]
Anton Korobeynikov16c29b52011-01-10 12:39:04 +00001//=- MBlazeFrameLowering.h - Define frame lowering for MicroBlaze -*- C++ -*-=//
Anton Korobeynikov33464912010-11-15 00:06:54 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//
11//
12//===----------------------------------------------------------------------===//
13
Wesley Peck8397be02010-12-09 03:42:04 +000014#ifndef MBLAZE_FRAMEINFO_H
15#define MBLAZE_FRAMEINFO_H
Anton Korobeynikov33464912010-11-15 00:06:54 +000016
17#include "MBlaze.h"
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000018#include "llvm/Target/TargetFrameLowering.h"
Anton Korobeynikov33464912010-11-15 00:06:54 +000019
20namespace llvm {
Craig Topper79aa3412012-03-17 18:46:09 +000021class MBlazeSubtarget;
Anton Korobeynikov33464912010-11-15 00:06:54 +000022
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000023class MBlazeFrameLowering : public TargetFrameLowering {
Anton Korobeynikov33464912010-11-15 00:06:54 +000024protected:
25 const MBlazeSubtarget &STI;
26
27public:
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000028 explicit MBlazeFrameLowering(const MBlazeSubtarget &sti)
29 : TargetFrameLowering(TargetFrameLowering::StackGrowsUp, 4, 0), STI(sti) {
Anton Korobeynikov33464912010-11-15 00:06:54 +000030 }
31
Anton Korobeynikov33464912010-11-15 00:06:54 +000032 /// targetHandlesStackFrameRounding - Returns true if the target is
33 /// responsible for rounding up the stack frame (probably at emitPrologue
34 /// time).
35 bool targetHandlesStackFrameRounding() const { return true; }
36
37 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
38 /// the function.
39 void emitPrologue(MachineFunction &MF) const;
40 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
Anton Korobeynikovd0c38172010-11-18 21:19:35 +000041
42 bool hasFP(const MachineFunction &MF) const;
Wesley Peck8397be02010-12-09 03:42:04 +000043
Wesley Peck3d2148f2011-01-05 17:34:20 +000044 int getFrameIndexOffset(const MachineFunction &MF, int FI) const;
45
Wesley Peck8397be02010-12-09 03:42:04 +000046 virtual void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
47 RegScavenger *RS) const;
Anton Korobeynikov33464912010-11-15 00:06:54 +000048};
49
50} // End llvm namespace
51
52#endif