1//===- llvm/CodeGen/GlobalISel/CombinerInfo.h ------*- 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/// \file
9/// Option class for Targets to specify which operations are combined how and
10/// when.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_GLOBALISEL_COMBINERINFO_H
15#define LLVM_CODEGEN_GLOBALISEL_COMBINERINFO_H
16
17#include <cassert>
18namespace llvm {
19
20class LegalizerInfo;
21
22// Contains information relevant to enabling/disabling various combines for a
23// pass.
24struct CombinerInfo {
25 CombinerInfo(bool AllowIllegalOps, bool ShouldLegalizeIllegal,
26 const LegalizerInfo *LInfo, bool OptEnabled, bool OptSize,
27 bool MinSize)
28 : IllegalOpsAllowed(AllowIllegalOps),
29 LegalizeIllegalOps(ShouldLegalizeIllegal), LInfo(LInfo),
30 EnableOpt(OptEnabled), EnableOptSize(OptSize), EnableMinSize(MinSize) {
31 assert(((AllowIllegalOps || !LegalizeIllegalOps) || LInfo) &&
32 "Expecting legalizerInfo when illegalops not allowed");
33 }
34 virtual ~CombinerInfo() = default;
35 /// If \p IllegalOpsAllowed is false, the CombinerHelper will make use of
36 /// the legalizerInfo to check for legality before each transformation.
37 bool IllegalOpsAllowed; // TODO: Make use of this.
38
39 /// If \p LegalizeIllegalOps is true, the Combiner will also legalize the
40 /// illegal ops that are created.
41 bool LegalizeIllegalOps; // TODO: Make use of this.
42 const LegalizerInfo *LInfo;
43
44 /// Whether optimizations should be enabled. This is to distinguish between
45 /// uses of the combiner unconditionally and only when optimizations are
46 /// specifically enabled/
47 bool EnableOpt;
48 /// Whether we're optimizing for size.
49 bool EnableOptSize;
50 /// Whether we're optimizing for minsize (-Oz).
51 bool EnableMinSize;
52};
53} // namespace llvm
54
55#endif
56

source code of llvm/include/llvm/CodeGen/GlobalISel/CombinerInfo.h