LLVM API Documentation

SparcFrameLowering.h
Go to the documentation of this file.
00001 //===-- SparcFrameLowering.h - Define frame lowering for Sparc --*- 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 //
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H
00015 #define LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H
00016 
00017 #include "Sparc.h"
00018 #include "llvm/Target/TargetFrameLowering.h"
00019 
00020 namespace llvm {
00021 
00022 class SparcSubtarget;
00023 class SparcFrameLowering : public TargetFrameLowering {
00024 public:
00025   explicit SparcFrameLowering(const SparcSubtarget &ST);
00026 
00027   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
00028   /// the function.
00029   void emitPrologue(MachineFunction &MF) const override;
00030   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
00031 
00032   void
00033   eliminateCallFramePseudoInstr(MachineFunction &MF,
00034                                 MachineBasicBlock &MBB,
00035                                 MachineBasicBlock::iterator I) const override;
00036 
00037   bool hasReservedCallFrame(const MachineFunction &MF) const override;
00038   bool hasFP(const MachineFunction &MF) const override;
00039   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
00040                                      RegScavenger *RS = nullptr) const override;
00041 
00042 private:
00043   // Remap input registers to output registers for leaf procedure.
00044   void remapRegsForLeafProc(MachineFunction &MF) const;
00045 
00046   // Returns true if MF is a leaf procedure.
00047   bool isLeafProc(MachineFunction &MF) const;
00048 
00049 
00050   // Emits code for adjusting SP in function prologue/epilogue.
00051   void emitSPAdjustment(MachineFunction &MF,
00052                         MachineBasicBlock &MBB,
00053                         MachineBasicBlock::iterator MBBI,
00054                         int NumBytes, unsigned ADDrr, unsigned ADDri) const;
00055 
00056 };
00057 
00058 } // End llvm namespace
00059 
00060 #endif