1//===- CodeGen/MachineConstantPool.h - Abstract Constant Pool ---*- C++ -*-===//
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
7//===----------------------------------------------------------------------===//
10/// This file declares the MachineConstantPool class which is an abstract
11/// constant pool to keep track of constants referenced by a function.
13//===----------------------------------------------------------------------===//
15#ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
16#define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
33/// Abstract base class for all machine specific constantpool value subclasses.
36 virtual void anchor();
53 /// print - Implement operator<<
63/// This class is a data container for one entry in a MachineConstantPool.
64/// It contains a pointer to the value and an offset from the start of
66/// An entry in a MachineConstantPool
69 /// The constant itself.
75 /// The required alignment for this entry.
90 /// isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry
91 /// is indeed a target specific constantpool entry, not a wrapper over a
99 /// This method classifies the entry according to whether or not it may
100 /// generate a relocation entry. This must be conservative, so if it might
101 /// codegen to a relocatable entry, it should say so.
107/// The MachineConstantPool class keeps track of constants referenced by a
108/// function which must be spilled to memory. This is used for constants which
109/// are unable to be used directly as operands to instructions, which typically
110/// include floating point and large integer constants.
112/// Instructions reference the address of these constant pool constants through
113/// the use of MO_ConstantPoolIndex values. When emitting assembly or machine
114/// code, these virtual address references are converted to refer to the
115/// address of the function constant pool values.
116/// The machine constant pool.
118 Align PoolAlignment;
///< The alignment for the pool.
119 std::vector<MachineConstantPoolEntry> Constants;
///< The pool of constants.
120 /// MachineConstantPoolValues that use an existing MachineConstantPoolEntry.
124 const DataLayout &getDataLayout()
const {
return DL; }
127 /// The only constructor.
129 : PoolAlignment(1), DL(DL) {}
132 /// Return the alignment required by the whole constant pool, of which the
133 /// first element must be aligned.
136 /// getConstantPoolIndex - Create a new entry in the constant pool or return
137 /// an existing one. User must specify the minimum required alignment for
142 /// isEmpty - Return true if this constant pool contains no constants.
143 bool isEmpty()
const {
return Constants.empty(); }
149 /// print - Used by the MachineFunction printer to print information about
150 /// constant pool objects. Implemented in MachineFunction.cpp
153 /// dump - Call print(cerr) to be called from the debugger.
157}
// end namespace llvm
159#endif // LLVM_CODEGEN_MACHINECONSTANTPOOL_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the DenseSet and SmallDenseSet classes.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Implements a dense probed hash-table based set.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
union llvm::MachineConstantPoolEntry::@004270020304201266316354007027341142157160323045 Val
The constant itself.
bool needsRelocation() const
This method classifies the entry according to whether or not it may generate a relocation entry.
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MachineConstantPoolEntry(const Constant *V, Align A)
MachineConstantPoolValue * MachineCPVal
Align Alignment
The required alignment for this entry.
unsigned getSizeInBytes(const DataLayout &DL) const
SectionKind getSectionKind(const DataLayout *DL) const
bool IsMachineConstantPoolEntry
const Constant * ConstVal
MachineConstantPoolEntry(MachineConstantPoolValue *V, Align A)
Abstract base class for all machine specific constantpool value subclasses.
virtual int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment)=0
virtual void print(raw_ostream &O) const =0
print - Implement operator<<
virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID)=0
virtual ~MachineConstantPoolValue()=default
MachineConstantPoolValue(Type *ty)
virtual unsigned getSizeInBytes(const DataLayout &DL) const
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
void dump() const
dump - Call print(cerr) to be called from the debugger.
MachineConstantPool(const DataLayout &DL)
The only constructor.
Align getConstantPoolAlign() const
Return the alignment required by the whole constant pool, of which the first element must be aligned.
const std::vector< MachineConstantPoolEntry > & getConstants() const
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about constant pool objects.
bool isEmpty() const
isEmpty - Return true if this constant pool contains no constants.
unsigned getConstantPoolIndex(const Constant *C, Align Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one.
SectionKind - This is a simple POD value that classifies the properties of a section.
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
This struct is a compact representation of a valid (non-zero power of two) alignment.