blob: 95ad294e366854fd2bcc0b7d9b1c8b97d2a994a9 [file] [log] [blame]
Pete Couperus2d1f6d62017-08-24 15:40:33 +00001//===- 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
20namespace llvm {
21
22/// ARCFunctionInfo - This class is derived from MachineFunction private
23/// ARC target-specific information for each MachineFunction.
24class ARCFunctionInfo : public MachineFunctionInfo {
25 virtual void anchor();
26 bool ReturnStackOffsetSet;
27 int VarArgsFrameIndex;
Pete Couperus2d1f6d62017-08-24 15:40:33 +000028 unsigned ReturnStackOffset;
29
30public:
31 ARCFunctionInfo()
Peter Collingbourne0d8fa1b2018-05-17 20:46:01 +000032 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
Pete Couperus2d1f6d62017-08-24 15:40:33 +000033 ReturnStackOffset(-1U), MaxCallStackReq(0) {}
34
35 explicit ARCFunctionInfo(MachineFunction &MF)
Peter Collingbourne0d8fa1b2018-05-17 20:46:01 +000036 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
Pete Couperus2d1f6d62017-08-24 15:40:33 +000037 ReturnStackOffset(-1U), MaxCallStackReq(0) {
38 // Functions are 4-byte (2**2) aligned.
39 MF.setAlignment(2);
40 }
41
42 ~ARCFunctionInfo() {}
43
44 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
45 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
46
47 void setReturnStackOffset(unsigned value) {
48 assert(!ReturnStackOffsetSet && "Return stack offset set twice");
49 ReturnStackOffset = value;
50 ReturnStackOffsetSet = true;
51 }
52
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