• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- ARCMachineFunctionInfo.h - ARC machine function info -----*- 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 // This file declares ARC-specific per-machine-function information.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
16 
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include <vector>
19 
20 namespace llvm {
21 
22 /// ARCFunctionInfo - This class is derived from MachineFunction private
23 /// ARC target-specific information for each MachineFunction.
24 class ARCFunctionInfo : public MachineFunctionInfo {
25   virtual void anchor();
26   bool ReturnStackOffsetSet;
27   int VarArgsFrameIndex;
28   unsigned ReturnStackOffset;
29 
30 public:
ARCFunctionInfo()31   ARCFunctionInfo()
32       : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
33         ReturnStackOffset(-1U), MaxCallStackReq(0) {}
34 
ARCFunctionInfo(MachineFunction & MF)35   explicit ARCFunctionInfo(MachineFunction &MF)
36       : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
37         ReturnStackOffset(-1U), MaxCallStackReq(0) {
38     // Functions are 4-byte (2**2) aligned.
39     MF.setAlignment(2);
40   }
41 
~ARCFunctionInfo()42   ~ARCFunctionInfo() {}
43 
setVarArgsFrameIndex(int off)44   void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
getVarArgsFrameIndex()45   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
46 
setReturnStackOffset(unsigned value)47   void setReturnStackOffset(unsigned value) {
48     assert(!ReturnStackOffsetSet && "Return stack offset set twice");
49     ReturnStackOffset = value;
50     ReturnStackOffsetSet = true;
51   }
52 
getReturnStackOffset()53   unsigned getReturnStackOffset() const {
54     assert(ReturnStackOffsetSet && "Return stack offset not set");
55     return ReturnStackOffset;
56   }
57 
58   unsigned MaxCallStackReq;
59 };
60 
61 } // end namespace llvm
62 
63 #endif // LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
64