|
|
|||
File indexing completed on 2026-05-10 08:43:23
0001 //===- llvm/CodeGen/GlobalISel/CombinerInfo.h ------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// \file 0009 /// Option class for Targets to specify which operations are combined how and 0010 /// when. 0011 /// 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_CODEGEN_GLOBALISEL_COMBINERINFO_H 0015 #define LLVM_CODEGEN_GLOBALISEL_COMBINERINFO_H 0016 0017 #include <cassert> 0018 namespace llvm { 0019 0020 class LegalizerInfo; 0021 0022 // Contains information relevant to enabling/disabling various combines for a 0023 // pass. 0024 struct CombinerInfo { 0025 CombinerInfo(bool AllowIllegalOps, bool ShouldLegalizeIllegal, 0026 const LegalizerInfo *LInfo, bool OptEnabled, bool OptSize, 0027 bool MinSize) 0028 : IllegalOpsAllowed(AllowIllegalOps), 0029 LegalizeIllegalOps(ShouldLegalizeIllegal), LInfo(LInfo), 0030 EnableOpt(OptEnabled), EnableOptSize(OptSize), EnableMinSize(MinSize) { 0031 assert(((AllowIllegalOps || !LegalizeIllegalOps) || LInfo) && 0032 "Expecting legalizerInfo when illegalops not allowed"); 0033 } 0034 virtual ~CombinerInfo() = default; 0035 /// If \p IllegalOpsAllowed is false, the CombinerHelper will make use of 0036 /// the legalizerInfo to check for legality before each transformation. 0037 bool IllegalOpsAllowed; // TODO: Make use of this. 0038 0039 /// If \p LegalizeIllegalOps is true, the Combiner will also legalize the 0040 /// illegal ops that are created. 0041 bool LegalizeIllegalOps; // TODO: Make use of this. 0042 const LegalizerInfo *LInfo; 0043 0044 /// Whether optimizations should be enabled. This is to distinguish between 0045 /// uses of the combiner unconditionally and only when optimizations are 0046 /// specifically enabled/ 0047 bool EnableOpt; 0048 /// Whether we're optimizing for size. 0049 bool EnableOptSize; 0050 /// Whether we're optimizing for minsize (-Oz). 0051 bool EnableMinSize; 0052 0053 /// The maximum number of times the Combiner will iterate over the 0054 /// MachineFunction. Setting this to 0 enables fixed-point iteration. 0055 unsigned MaxIterations = 0; 0056 0057 enum class ObserverLevel { 0058 /// Only retry combining created/changed instructions. 0059 /// This replicates the legacy default Observer behavior for use with 0060 /// fixed-point iteration. 0061 Basic, 0062 /// Enables Observer-based detection of dead instructions. This can save 0063 /// some compile-time if full disabling of fixed-point iteration is not 0064 /// desired. If the input IR doesn't contain dead instructions, consider 0065 /// disabling \p EnableFullDCE. 0066 DCE, 0067 /// Enables Observer-based DCE and additional heuristics that retry 0068 /// combining defined and used instructions of modified instructions. 0069 /// This provides a good balance between compile-time and completeness of 0070 /// combining without needing fixed-point iteration. 0071 SinglePass, 0072 }; 0073 0074 /// Select how the Combiner acts on MIR changes. 0075 ObserverLevel ObserverLvl = ObserverLevel::Basic; 0076 0077 /// Whether dead code elimination is performed before each Combiner iteration. 0078 /// If Observer-based DCE is enabled, this controls if a full DCE pass is 0079 /// performed before the first Combiner iteration. 0080 bool EnableFullDCE = true; 0081 }; 0082 } // namespace llvm 0083 0084 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|