LLVM API Documentation

ARMFrameLowering.h
Go to the documentation of this file.
00001 //==-- ARMTargetFrameLowering.h - Define frame lowering for ARM --*- 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_ARM_ARMFRAMELOWERING_H
00015 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
00016 
00017 #include "llvm/Target/TargetFrameLowering.h"
00018 
00019 namespace llvm {
00020   class ARMSubtarget;
00021 
00022 class ARMFrameLowering : public TargetFrameLowering {
00023 protected:
00024   const ARMSubtarget &STI;
00025 
00026 public:
00027   explicit ARMFrameLowering(const ARMSubtarget &sti);
00028 
00029   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
00030   /// the function.
00031   void emitPrologue(MachineFunction &MF) const override;
00032   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
00033 
00034   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
00035                                  MachineBasicBlock::iterator MI,
00036                                  const std::vector<CalleeSavedInfo> &CSI,
00037                                  const TargetRegisterInfo *TRI) const override;
00038 
00039   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
00040                                   MachineBasicBlock::iterator MI,
00041                                   const std::vector<CalleeSavedInfo> &CSI,
00042                                   const TargetRegisterInfo *TRI) const override;
00043 
00044   bool hasFP(const MachineFunction &MF) const override;
00045   bool hasReservedCallFrame(const MachineFunction &MF) const override;
00046   bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
00047   int getFrameIndexReference(const MachineFunction &MF, int FI,
00048                              unsigned &FrameReg) const override;
00049   int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
00050                                  unsigned &FrameReg, int SPAdj) const;
00051   int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
00052 
00053   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
00054                                             RegScavenger *RS) const override;
00055 
00056   void adjustForSegmentedStacks(MachineFunction &MF) const override;
00057 
00058  private:
00059   void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
00060                     const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
00061                     unsigned StrOpc, bool NoGap,
00062                     bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
00063                     unsigned MIFlags = 0) const;
00064   void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
00065                    const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
00066                    unsigned LdrOpc, bool isVarArg, bool NoGap,
00067                    bool(*Func)(unsigned, bool),
00068                    unsigned NumAlignedDPRCS2Regs) const;
00069 
00070   void
00071   eliminateCallFramePseudoInstr(MachineFunction &MF,
00072                                 MachineBasicBlock &MBB,
00073                                 MachineBasicBlock::iterator MI) const override;
00074 };
00075 
00076 } // End llvm namespace
00077 
00078 #endif