LCOV - code coverage report
Current view: top level - lib/Target/WebAssembly - WebAssemblyFrameLowering.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2018-10-20 13:21:21 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : // WebAssemblyFrameLowering.h - TargetFrameLowering for WebAssembly -*- C++ -*-/
       2             : //
       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             : /// \file
      11             : /// This class implements WebAssembly-specific bits of
      12             : /// TargetFrameLowering class.
      13             : ///
      14             : //===----------------------------------------------------------------------===//
      15             : 
      16             : #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYFRAMELOWERING_H
      17             : #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYFRAMELOWERING_H
      18             : 
      19             : #include "llvm/CodeGen/TargetFrameLowering.h"
      20             : 
      21             : namespace llvm {
      22             : class MachineFrameInfo;
      23             : 
      24             : class WebAssemblyFrameLowering final : public TargetFrameLowering {
      25             : public:
      26             :   /// Size of the red zone for the user stack (leaf functions can use this much
      27             :   /// space below the stack pointer without writing it back to __stack_pointer
      28             :   /// global).
      29             :   // TODO: (ABI) Revisit and decide how large it should be.
      30             :   static const size_t RedZoneSize = 128;
      31             : 
      32             :   WebAssemblyFrameLowering()
      33             :       : TargetFrameLowering(StackGrowsDown, /*StackAlignment=*/16,
      34             :                             /*LocalAreaOffset=*/0,
      35             :                             /*TransientStackAlignment=*/16,
      36         293 :                             /*StackRealignable=*/true) {}
      37             : 
      38             :   MachineBasicBlock::iterator
      39             :   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
      40             :                                 MachineBasicBlock::iterator I) const override;
      41             : 
      42             :   /// These methods insert prolog and epilog code into the function.
      43             :   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
      44             :   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
      45             : 
      46             :   bool hasFP(const MachineFunction &MF) const override;
      47             :   bool hasReservedCallFrame(const MachineFunction &MF) const override;
      48             : 
      49             :   bool needsPrologForEH(const MachineFunction &MF) const;
      50             : 
      51             :   /// Write SP back to __stack_pointer global.
      52             :   void writeSPToGlobal(unsigned SrcReg, MachineFunction &MF,
      53             :                        MachineBasicBlock &MBB,
      54             :                        MachineBasicBlock::iterator &InsertStore,
      55             :                        const DebugLoc &DL) const;
      56             : 
      57             : private:
      58             :   bool hasBP(const MachineFunction &MF) const;
      59             :   bool needsSPForLocalFrame(const MachineFunction &MF) const;
      60             :   bool needsSP(const MachineFunction &MF) const;
      61             :   bool needsSPWriteback(const MachineFunction &MF) const;
      62             : };
      63             : 
      64             : } // end namespace llvm
      65             : 
      66             : #endif

Generated by: LCOV version 1.13