aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/MC/MCCFI.h
blob: e6ac396527e01e3b1489ac4716cbdc018ee23719 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_MC_MCCFI_H
#define RCC_MC_MCCFI_H

#include "rcc/MC/MCSymbol.h"
#include "rcc/Support/Error.h"

#include <cstdint>
#include <vector>

namespace rcc::mc {

enum class MCCFIOperation : std::uint8_t {
  StartProc,
  EndProc,
  Sections,
  Personality,
  LSDA,
  SignalFrame,
  ReturnColumn,
  SameValue,
  RememberState,
  RestoreState,
  Offset,
  DefCFARegister,
  DefCFAOffset,
  DefCFA,
  RelativeOffset,
  AdjustCFAOffset,
  Escape,
  Restore,
  Undefined,
  Register,
  WindowSave,
  NegateReturnAddressState,
  NegateReturnAddressStateWithPC,
  GNUArgsSize,
  Label,
  ValueOffset,
};

struct MCCFIInstruction final {
  MCCFIOperation Operation = MCCFIOperation::StartProc;
  std::vector<std::int64_t> Operands;
  std::vector<std::uint8_t> Bytes;
  MCSymbolRef Symbol;

  [[nodiscard]] Expected<void> verify() const;
};

} // namespace rcc::mc

#endif // RCC_MC_MCCFI_H