13#ifndef LLVM_CODEGEN_MFPROPSMODIFIER_H
14#define LLVM_CODEGEN_MFPROPSMODIFIER_H
30 auto &MFProps = MF.getProperties();
32 if constexpr (has_get_required_properties_v<PassT>) {
33 auto &MFProps = MF.getProperties();
34 auto RequiredProperties = P.getRequiredProperties();
35 if (!MFProps.verifyRequiredProperties(RequiredProperties)) {
36 errs() <<
"MachineFunctionProperties required by " << PassT::name()
37 <<
" pass are not met by function " << MF.getName() <<
".\n"
38 <<
"Required properties: ";
39 RequiredProperties.print(
errs());
40 errs() <<
"\nCurrent properties: ";
41 MFProps.print(
errs());
47 if constexpr (has_get_cleared_properties_v<PassT>)
48 MFProps.reset(P.getClearedProperties());
52 if constexpr (has_get_set_properties_v<PassT>) {
53 auto &MFProps = MF.getProperties();
54 MFProps.set(P.getSetProperties());
63 using has_get_required_properties_t =
64 decltype(std::declval<T &>().getRequiredProperties());
67 using has_get_set_properties_t =
68 decltype(std::declval<T &>().getSetProperties());
71 using has_get_cleared_properties_t =
72 decltype(std::declval<T &>().getClearedProperties());
75 static constexpr bool has_get_required_properties_v =
79 static constexpr bool has_get_set_properties_v =
83 static constexpr bool has_get_cleared_properties_v =
88template <
typename PassT>
An RAII based helper class to modify MachineFunctionProperties when running pass.
MFPropsModifier(const PassT &P_, MachineFunction &MF_)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
MFPropsModifier(PassT &P, MachineFunction &MF) -> MFPropsModifier< PassT >
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.