LLVM API Documentation

SystemZFrameLowering.h
Go to the documentation of this file.
00001 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
00011 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
00012 
00013 #include "llvm/ADT/IndexedMap.h"
00014 #include "llvm/Target/TargetFrameLowering.h"
00015 
00016 namespace llvm {
00017 class SystemZTargetMachine;
00018 class SystemZSubtarget;
00019 
00020 class SystemZFrameLowering : public TargetFrameLowering {
00021   IndexedMap<unsigned> RegSpillOffsets;
00022 
00023 public:
00024   SystemZFrameLowering();
00025 
00026   // Override TargetFrameLowering.
00027   bool isFPCloseToIncomingSP() const override { return false; }
00028   const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
00029     override;
00030   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
00031                                             RegScavenger *RS) const override;
00032   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
00033                                  MachineBasicBlock::iterator MBBI,
00034                                  const std::vector<CalleeSavedInfo> &CSI,
00035                                  const TargetRegisterInfo *TRI) const override;
00036   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
00037                                    MachineBasicBlock::iterator MBBII,
00038                                    const std::vector<CalleeSavedInfo> &CSI,
00039                                    const TargetRegisterInfo *TRI) const
00040     override;
00041   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
00042                                            RegScavenger *RS) const override;
00043   void emitPrologue(MachineFunction &MF) const override;
00044   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
00045   bool hasFP(const MachineFunction &MF) const override;
00046   int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
00047   bool hasReservedCallFrame(const MachineFunction &MF) const override;
00048   void eliminateCallFramePseudoInstr(MachineFunction &MF,
00049                                      MachineBasicBlock &MBB,
00050                                      MachineBasicBlock::iterator MI) const
00051     override;
00052 
00053   // Return the number of bytes in the callee-allocated part of the frame.
00054   uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
00055 
00056   // Return the byte offset from the incoming stack pointer of Reg's
00057   // ABI-defined save slot.  Return 0 if no slot is defined for Reg.
00058   unsigned getRegSpillOffset(unsigned Reg) const {
00059     return RegSpillOffsets[Reg];
00060   }
00061 };
00062 } // end namespace llvm
00063 
00064 #endif