//===-- llvm/OperandTraits.h - OperandTraits class definition ---*- 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 defines the traits classes that are handy for enforcing the correct // layout of various User subclasses. It also provides the means for accessing // the operands in the most efficient manner. // #ifndef LLVM_IR_OPERANDTRAITS_H #define LLVM_IR_OPERANDTRAITS_H #include "llvm/IR/User.h" namespace llvm { //===----------------------------------------------------------------------===// // FixedNumOperand Trait Class //===----------------------------------------------------------------------===// /// FixedNumOperandTraits - determine the allocation regime of the Use array /// when it is a prefix to the User object, and the number of Use objects is /// known at compile time. template <typename SubClass, unsigned ARITY> struct FixedNumOperandTraits { … }; //===----------------------------------------------------------------------===// // OptionalOperand Trait Class //===----------------------------------------------------------------------===// /// OptionalOperandTraits - when the number of operands may change at runtime. /// Naturally it may only decrease, because the allocations may not change. template <typename SubClass, unsigned ARITY = 1> struct OptionalOperandTraits : public FixedNumOperandTraits<SubClass, ARITY> { … }; //===----------------------------------------------------------------------===// // VariadicOperand Trait Class //===----------------------------------------------------------------------===// /// VariadicOperandTraits - determine the allocation regime of the Use array /// when it is a prefix to the User object, and the number of Use objects is /// only known at allocation time. template <typename SubClass, unsigned MINARITY = 0> struct VariadicOperandTraits { … }; //===----------------------------------------------------------------------===// // HungoffOperand Trait Class //===----------------------------------------------------------------------===// /// HungoffOperandTraits - determine the allocation regime of the Use array /// when it is not a prefix to the User object, but allocated at an unrelated /// heap address. /// /// This is the traits class that is needed when the Use array must be /// resizable. template <unsigned MINARITY = 1> struct HungoffOperandTraits { … }; /// Macro for generating in-class operand accessor declarations. /// It should only be called in the public section of the interface. /// #define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS) … /// Macro for generating out-of-class operand accessor definitions #define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS) … } // End llvm namespace #endif