LLVM  11.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 || MF.getFunction().hasFnAttribute("interrupt");
59  this->IsSignalHandler = CallConv == CallingConv::AVR_SIGNAL || MF.getFunction().hasFnAttribute("signal");
60  }
61 
62  bool getHasSpills() const { return HasSpills; }
63  void setHasSpills(bool B) { HasSpills = B; }
64 
65  bool getHasAllocas() const { return HasAllocas; }
66  void setHasAllocas(bool B) { HasAllocas = B; }
67 
68  bool getHasStackArgs() const { return HasStackArgs; }
69  void setHasStackArgs(bool B) { HasStackArgs = B; }
70 
71  /// Checks if the function is some form of interrupt service routine.
73 
74  bool isInterruptHandler() const { return IsInterruptHandler; }
75  bool isSignalHandler() const { return IsSignalHandler; }
76 
77  unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
78  void setCalleeSavedFrameSize(unsigned Bytes) { CalleeSavedFrameSize = Bytes; }
79 
80  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
81  void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
82 };
83 
84 } // end llvm namespace
85 
86 #endif // LLVM_AVR_MACHINE_FUNCTION_INFO_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isInterruptOrSignalHandler() const
Checks if the function is some form of interrupt service routine.
Calling convention used for AVR signal routines.
Definition: CallingConv.h:190
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:330
Function & getFunction()
Return the LLVM function that this machine code represents.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Used for AVR interrupt routines.
Definition: CallingConv.h:187
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Contains AVR-specific information for each MachineFunction.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:219
void setCalleeSavedFrameSize(unsigned Bytes)
AVRMachineFunctionInfo(MachineFunction &MF)