blob: 31aa5b93246cfed4bdce8b807bb8076b7ef12205 [file] [log] [blame]
Pete Couperus2d1f6d62017-08-24 15:40:33 +00001//===- ARCMachineFunctionInfo.h - ARC machine function info -----*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Pete Couperus2d1f6d62017-08-24 15:40:33 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares ARC-specific per-machine-function information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
15
16#include "llvm/CodeGen/MachineFunction.h"
17#include <vector>
18
19namespace llvm {
20
21/// ARCFunctionInfo - This class is derived from MachineFunction private
22/// ARC target-specific information for each MachineFunction.
23class ARCFunctionInfo : public MachineFunctionInfo {
24 virtual void anchor();
25 bool ReturnStackOffsetSet;
26 int VarArgsFrameIndex;
Pete Couperus2d1f6d62017-08-24 15:40:33 +000027 unsigned ReturnStackOffset;
28
29public:
30 ARCFunctionInfo()
Peter Collingbourne0d8fa1b2018-05-17 20:46:01 +000031 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
Pete Couperus2d1f6d62017-08-24 15:40:33 +000032 ReturnStackOffset(-1U), MaxCallStackReq(0) {}
33
34 explicit ARCFunctionInfo(MachineFunction &MF)
Peter Collingbourne0d8fa1b2018-05-17 20:46:01 +000035 : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
Pete Couperus2d1f6d62017-08-24 15:40:33 +000036 ReturnStackOffset(-1U), MaxCallStackReq(0) {
37 // Functions are 4-byte (2**2) aligned.
38 MF.setAlignment(2);
39 }
40
41 ~ARCFunctionInfo() {}
42
43 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
44 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
45
46 void setReturnStackOffset(unsigned value) {
47 assert(!ReturnStackOffsetSet && "Return stack offset set twice");
48 ReturnStackOffset = value;
49 ReturnStackOffsetSet = true;
50 }
51
52 unsigned getReturnStackOffset() const {
53 assert(ReturnStackOffsetSet && "Return stack offset not set");
54 return ReturnStackOffset;
55 }
56
57 unsigned MaxCallStackReq;
58};
59
60} // end namespace llvm
61
62#endif // LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H