LLVM  16.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 
17 
18 namespace llvm {
19 
20 /// Contains AVR-specific information for each MachineFunction.
22  /// Indicates if a register has been spilled by the register
23  /// allocator.
24  bool HasSpills;
25 
26  /// Indicates if there are any fixed size allocas present.
27  /// Note that if there are only variable sized allocas this is set to false.
28  bool HasAllocas;
29 
30  /// Indicates if arguments passed using the stack are being
31  /// used inside the function.
32  bool HasStackArgs;
33 
34  /// Whether or not the function is an interrupt handler.
35  bool IsInterruptHandler;
36 
37  /// Whether or not the function is an non-blocking interrupt handler.
38  bool IsSignalHandler;
39 
40  /// Size of the callee-saved register portion of the
41  /// stack frame in bytes.
42  unsigned CalleeSavedFrameSize;
43 
44  /// FrameIndex for start of varargs area.
45  int VarArgsFrameIndex;
46 
47 public:
49  : HasSpills(false), HasAllocas(false), HasStackArgs(false),
50  IsInterruptHandler(false), IsSignalHandler(false),
51  CalleeSavedFrameSize(0), VarArgsFrameIndex(0) {}
52 
54  : HasSpills(false), HasAllocas(false), HasStackArgs(false),
55  CalleeSavedFrameSize(0), VarArgsFrameIndex(0) {
56  unsigned CallConv = MF.getFunction().getCallingConv();
57 
58  this->IsInterruptHandler = CallConv == CallingConv::AVR_INTR ||
59  MF.getFunction().hasFnAttribute("interrupt");
60  this->IsSignalHandler = CallConv == CallingConv::AVR_SIGNAL ||
61  MF.getFunction().hasFnAttribute("signal");
62  }
63 
67  const override {
68  return DestMF.cloneInfo<AVRMachineFunctionInfo>(*this);
69  }
70 
71  bool getHasSpills() const { return HasSpills; }
72  void setHasSpills(bool B) { HasSpills = B; }
73 
74  bool getHasAllocas() const { return HasAllocas; }
75  void setHasAllocas(bool B) { HasAllocas = B; }
76 
77  bool getHasStackArgs() const { return HasStackArgs; }
78  void setHasStackArgs(bool B) { HasStackArgs = B; }
79 
80  /// Checks if the function is some form of interrupt service routine.
82  return isInterruptHandler() || isSignalHandler();
83  }
84 
85  bool isInterruptHandler() const { return IsInterruptHandler; }
86  bool isSignalHandler() const { return IsSignalHandler; }
87 
88  unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
89  void setCalleeSavedFrameSize(unsigned Bytes) { CalleeSavedFrameSize = Bytes; }
90 
91  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
92  void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
93 };
94 
95 } // namespace llvm
96 
97 #endif // LLVM_AVR_MACHINE_FUNCTION_INFO_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::AVRMachineFunctionInfo::setHasStackArgs
void setHasStackArgs(bool B)
Definition: AVRMachineFunctionInfo.h:78
llvm::AVRMachineFunctionInfo::getVarArgsFrameIndex
int getVarArgsFrameIndex() const
Definition: AVRMachineFunctionInfo.h:91
llvm::AVRMachineFunctionInfo::clone
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Definition: AVRMachineFunctionInfo.h:65
llvm::AVRMachineFunctionInfo::getHasStackArgs
bool getHasStackArgs() const
Definition: AVRMachineFunctionInfo.h:77
llvm::AVRMachineFunctionInfo::setCalleeSavedFrameSize
void setCalleeSavedFrameSize(unsigned Bytes)
Definition: AVRMachineFunctionInfo.h:89
llvm::AVRMachineFunctionInfo::isSignalHandler
bool isSignalHandler() const
Definition: AVRMachineFunctionInfo.h:86
false
Definition: StackSlotColoring.cpp:141
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::AVRMachineFunctionInfo::getCalleeSavedFrameSize
unsigned getCalleeSavedFrameSize() const
Definition: AVRMachineFunctionInfo.h:88
llvm::Function::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.cpp:628
llvm::AVRMachineFunctionInfo::AVRMachineFunctionInfo
AVRMachineFunctionInfo()
Definition: AVRMachineFunctionInfo.h:48
llvm::Function::getCallingConv
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:238
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::DenseMap
Definition: DenseMap.h:714
llvm::AVRMachineFunctionInfo::isInterruptHandler
bool isInterruptHandler() const
Definition: AVRMachineFunctionInfo.h:85
llvm::AVRMachineFunctionInfo::setHasSpills
void setHasSpills(bool B)
Definition: AVRMachineFunctionInfo.h:72
llvm::AVRMachineFunctionInfo::setHasAllocas
void setHasAllocas(bool B)
Definition: AVRMachineFunctionInfo.h:75
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::AVRMachineFunctionInfo::getHasSpills
bool getHasSpills() const
Definition: AVRMachineFunctionInfo.h:71
llvm::CallingConv::AVR_SIGNAL
@ AVR_SIGNAL
Used for AVR signal routines.
Definition: CallingConv.h:180
llvm::AVRMachineFunctionInfo::getHasAllocas
bool getHasAllocas() const
Definition: AVRMachineFunctionInfo.h:74
llvm::MachineFunction::cloneInfo
Ty * cloneInfo(const Ty &Old)
Definition: MachineFunction.h:765
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:622
llvm::CallingConv::AVR_INTR
@ AVR_INTR
Used for AVR interrupt routines.
Definition: CallingConv.h:177
llvm::AVRMachineFunctionInfo::isInterruptOrSignalHandler
bool isInterruptOrSignalHandler() const
Checks if the function is some form of interrupt service routine.
Definition: AVRMachineFunctionInfo.h:81
llvm::AVRMachineFunctionInfo::setVarArgsFrameIndex
void setVarArgsFrameIndex(int Idx)
Definition: AVRMachineFunctionInfo.h:92
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:143
llvm::AVRMachineFunctionInfo
Contains AVR-specific information for each MachineFunction.
Definition: AVRMachineFunctionInfo.h:21
llvm::AVRMachineFunctionInfo::AVRMachineFunctionInfo
AVRMachineFunctionInfo(MachineFunction &MF)
Definition: AVRMachineFunctionInfo.h:53
MachineFunction.h
llvm::MachineFunctionInfo
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Definition: MachineFunction.h:95