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 VarArgFrameBytes; 29 unsigned ReturnStackOffset; 30 31 public: 32 ARCFunctionInfo() 33 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0), VarArgFrameBytes(0), 34 ReturnStackOffset(-1U), MaxCallStackReq(0) {} 35 36 explicit ARCFunctionInfo(MachineFunction &MF) 37 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0), VarArgFrameBytes(0), 38 ReturnStackOffset(-1U), MaxCallStackReq(0) { 39 // Functions are 4-byte (2**2) aligned. 40 MF.setAlignment(2); 41 } 42 43 ~ARCFunctionInfo() {} 44 45 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; } 46 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 47 48 void setReturnStackOffset(unsigned value) { 49 assert(!ReturnStackOffsetSet && "Return stack offset set twice"); 50 ReturnStackOffset = value; 51 ReturnStackOffsetSet = true; 52 } 53 54 unsigned getReturnStackOffset() const { 55 assert(ReturnStackOffsetSet && "Return stack offset not set"); 56 return ReturnStackOffset; 57 } 58 59 unsigned MaxCallStackReq; 60 }; 61 62 } // end namespace llvm 63 64 #endif // LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H 65