//===- CodeGenDAGPatterns.h - Read DAG patterns from .td file ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file declares the CodeGenDAGPatterns class, which is used to read and // represent the patterns present in a .td file for instructions. // //===----------------------------------------------------------------------===// #ifndef LLVM_UTILS_TABLEGEN_COMMON_CODEGENDAGPATTERNS_H #define LLVM_UTILS_TABLEGEN_COMMON_CODEGENDAGPATTERNS_H #include "Basic/CodeGenIntrinsics.h" #include "Basic/SDNodeProperties.h" #include "CodeGenTarget.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/TableGen/Record.h" #include <algorithm> #include <array> #include <functional> #include <map> #include <numeric> #include <vector> namespace llvm { class Init; class ListInit; class DagInit; class SDNodeInfo; class TreePattern; class TreePatternNode; class CodeGenDAGPatterns; /// Shared pointer for TreePatternNode. TreePatternNodePtr; /// This represents a set of MVTs. Since the underlying type for the MVT /// is uint16_t, there are at most 65536 values. To reduce the number of memory /// allocations and deallocations, represent the set as a sequence of bits. /// To reduce the allocations even further, make MachineValueTypeSet own /// the storage and use std::array as the bit container. struct MachineValueTypeSet { … }; raw_ostream &operator<<(raw_ostream &OS, const MachineValueTypeSet &T); struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> { … }; raw_ostream &operator<<(raw_ostream &OS, const TypeSetByHwMode &T); struct TypeInfer { … }; /// Set type used to track multiply used variables in patterns MultipleUseVarSet; /// SDTypeConstraint - This is a discriminated union of constraints, /// corresponding to the SDTypeConstraint tablegen class in Target.td. struct SDTypeConstraint { … }; /// ScopedName - A name of a node associated with a "scope" that indicates /// the context (e.g. instance of Pattern or PatFrag) in which the name was /// used. This enables substitution of pattern fragments while keeping track /// of what name(s) were originally given to various nodes in the tree. class ScopedName { … }; /// SDNodeInfo - One of these records is created for each SDNode instance in /// the target .td file. This represents the various dag nodes we will be /// processing. class SDNodeInfo { … }; /// TreePredicateFn - This is an abstraction that represents the predicates on /// a PatFrag node. This is a simple one-word wrapper around a pointer to /// provide nice accessors. class TreePredicateFn { … }; struct TreePredicateCall { … }; class TreePatternNode : public RefCountedBase<TreePatternNode> { … }; inline raw_ostream &operator<<(raw_ostream &OS, const TreePatternNode &TPN) { … } /// TreePattern - Represent a pattern, used for instructions, pattern /// fragments, etc. /// class TreePattern { … }; inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, const TypeSetByHwMode &InTy, TreePattern &TP) { … } inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, MVT::SimpleValueType InTy, TreePattern &TP) { … } inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, const ValueTypeByHwMode &InTy, TreePattern &TP) { … } /// DAGDefaultOperand - One of these is created for each OperandWithDefaultOps /// that has a set ExecuteAlways / DefaultOps field. struct DAGDefaultOperand { … }; class DAGInstruction { … }; /// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns /// processed to produce isel. class PatternToMatch { … }; class CodeGenDAGPatterns { … }; inline bool SDNodeInfo::ApplyTypeConstraints(TreePatternNode &N, TreePattern &TP) const { … } } // end namespace llvm #endif // LLVM_UTILS_TABLEGEN_COMMON_CODEGENDAGPATTERNS_H