aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/CodeGen/TargetPseudoExpansion.h
blob: 5135d78a21defae4cb7ec1291c0c934a58c8c691 (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
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_CODEGEN_TARGETPSEUDOEXPANSION_H
#define RCC_CODEGEN_TARGETPSEUDOEXPANSION_H

#include "rcc/Support/Error.h"

#include <cstdint>

namespace rcc {

class MachineFunction;
class MachineInstr;
class TargetDescription;

enum class MachinePseudoExpansionPhase : std::uint8_t {
  PreRA,
  PrePEI,
  PostRA,
  TargetLate,
};

class TargetPseudoExpansionInfo {
public:
  virtual ~TargetPseudoExpansionInfo() = default;

  [[nodiscard]] virtual Expected<bool> preparePostRAPseudo(MachineInstr &, MachineFunction &,
                                                           const TargetDescription &) const {
    return false;
  }

  [[nodiscard]] virtual Expected<bool> expandPseudo(MachineInstr &, MachinePseudoExpansionPhase,
                                                    MachineFunction &,
                                                    const TargetDescription &) const {
    return false;
  }
};

} // namespace rcc

#endif // RCC_CODEGEN_TARGETPSEUDOEXPANSION_H