//===-- llvm/Constant.h - Constant 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 contains the declaration of the Constant class. // //===----------------------------------------------------------------------===// #ifndef LLVM_IR_CONSTANT_H #define LLVM_IR_CONSTANT_H #include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" namespace llvm { class ConstantRange; class APInt; /// This is an important base class in LLVM. It provides the common facilities /// of all constant values in an LLVM program. A constant is a value that is /// immutable at runtime. Functions are constants because their address is /// immutable. Same with global variables. /// /// All constants share the capabilities provided in this class. All constants /// can have a null value. They can have an operand list. Constants can be /// simple (integer and floating point values), complex (arrays and structures), /// or expression based (computations yielding a constant value composed of /// only certain operators and other constant values). /// /// Note that Constants are immutable (once created they never change) /// and are fully shared by structural equivalence. This means that two /// structurally equivalent constants will always have the same address. /// Constants are created on demand as needed and never deleted: thus clients /// don't have to worry about the lifetime of the objects. /// LLVM Constant Representation class Constant : public User { … }; } // end namespace llvm #endif // LLVM_IR_CONSTANT_H