LLVM 24.0.0git
AVRMachineFunctionInfo.h
Go to the documentation of this file.
1//===-- AVRMachineFuctionInfo.h - AVR machine function info -----*- C++ -*-===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares AVR-specific per-machine-function information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_AVR_MACHINE_FUNCTION_INFO_H
14#define LLVM_AVR_MACHINE_FUNCTION_INFO_H
15
18
19namespace llvm {
20
21/// Contains AVR-specific information for each MachineFunction.
23 /// Indicates if a register has been spilled by the register
24 /// allocator.
25 bool HasSpills;
26
27 /// Indicates if there are any fixed size allocas present.
28 /// Note that if there are only variable sized allocas this is set to false.
29 bool HasAllocas;
30
31 /// Indicates if arguments passed using the stack are being
32 /// used inside the function.
33 bool HasStackArgs;
34
35 /// Whether or not the function is an interrupt handler.
36 bool IsInterruptHandler;
37
38 /// Whether or not the function is an non-blocking interrupt handler.
39 bool IsSignalHandler;
40
41 /// Size of the callee-saved register portion of the
42 /// stack frame in bytes.
43 unsigned CalleeSavedFrameSize;
44
45 /// FrameIndex for start of varargs area.
46 int VarArgsFrameIndex;
47
48public:
51
53 : HasSpills(false), HasAllocas(false), HasStackArgs(false),
54 CalleeSavedFrameSize(0), VarArgsFrameIndex(0) {
55 CallingConv::ID CallConv = F.getCallingConv();
56
57 this->IsInterruptHandler =
58 CallConv == CallingConv::AVR_INTR || F.hasFnAttribute("interrupt");
59
60 this->IsSignalHandler =
61 CallConv == CallingConv::AVR_SIGNAL || F.hasFnAttribute("signal");
62
63 this->AlignedStackReg = 0;
64 this->AlignedStackObjectIdx = 0;
65 }
66
70 const override {
71 return DestMF.cloneInfo<AVRMachineFunctionInfo>(*this);
72 }
73
74 bool getHasSpills() const { return HasSpills; }
75 void setHasSpills(bool B) { HasSpills = B; }
76
77 bool getHasAllocas() const { return HasAllocas; }
78 void setHasAllocas(bool B) { HasAllocas = B; }
79
80 bool getHasStackArgs() const { return HasStackArgs; }
81 void setHasStackArgs(bool B) { HasStackArgs = B; }
82
83 /// Checks if the function is some form of interrupt service routine.
86 }
87
88 bool isInterruptHandler() const { return IsInterruptHandler; }
89 bool isSignalHandler() const { return IsSignalHandler; }
90
91 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
92 void setCalleeSavedFrameSize(unsigned Bytes) { CalleeSavedFrameSize = Bytes; }
93
94 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
95 void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
96};
97
98} // namespace llvm
99
100#endif // LLVM_AVR_MACHINE_FUNCTION_INFO_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define F(x, y, z)
Definition MD5.cpp:54
Basic Register Allocator
void setCalleeSavedFrameSize(unsigned Bytes)
AVRMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
bool isInterruptOrSignalHandler() const
Checks if the function is some form of interrupt service routine.
Ty * cloneInfo(const Ty &Old)
Wrapper class representing virtual and physical registers.
Definition Register.h:20
TargetSubtargetInfo - Generic base class for all target subtargets.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ AVR_SIGNAL
Used for AVR signal routines.
@ AVR_INTR
Used for AVR interrupt routines.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...