1 //===- CSEConfigBase.h - A CSEConfig interface ------------------*- 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 9 #ifndef LLVM_CODEGEN_CSECONFIG_BASE_H 10 #define LLVM_CODEGEN_CSECONFIG_BASE_H 11 12 namespace llvm { 13 // Class representing some configuration that can be done during GlobalISel's 14 // CSEInfo analysis. We define it here because TargetPassConfig can't depend on 15 // the GlobalISel library, and so we use this in the interface between them 16 // so that the derived classes in GISel can reference generic opcodes. 17 class CSEConfigBase { 18 public: 19 virtual ~CSEConfigBase() = default; 20 // Hook for defining which Generic instructions should be CSEd. 21 // GISelCSEInfo currently only calls this hook when dealing with generic 22 // opcodes. shouldCSEOpc(unsigned Opc)23 virtual bool shouldCSEOpc(unsigned Opc) { return false; } 24 }; 25 26 } // namespace llvm 27 28 #endif // LLVM_CODEGEN_CSECONFIG_BASE_H 29