LLVM 22.0.0git
RISCVConstantPoolValue.h
Go to the documentation of this file.
1//===--- RISCVConstantPoolValue.h - RISC-V constantpool value ---*- 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// This file implements the RISC-V specific constantpool value class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_RISCV_RISCVCONSTANTPOOLVALUE_H
14#define LLVM_LIB_TARGET_RISCV_RISCVCONSTANTPOOLVALUE_H
15
16#include "llvm/ADT/StringRef.h"
20
21namespace llvm {
22
23class BlockAddress;
24class GlobalValue;
25class LLVMContext;
26
27/// A RISCV-specific constant pool value.
28class RISCVConstantPoolValue : public MachineConstantPoolValue {
29 const GlobalValue *GV;
30 const StringRef S;
31
32 RISCVConstantPoolValue(Type *Ty, const GlobalValue *GV);
33 RISCVConstantPoolValue(LLVMContext &C, StringRef S);
34
35private:
36 enum class RISCVCPKind { ExtSymbol, GlobalValue };
37 RISCVCPKind Kind;
38
39public:
41
42 static RISCVConstantPoolValue *Create(const GlobalValue *GV);
43 static RISCVConstantPoolValue *Create(LLVMContext &C, StringRef S);
44
45 bool isGlobalValue() const { return Kind == RISCVCPKind::GlobalValue; }
46 bool isExtSymbol() const { return Kind == RISCVCPKind::ExtSymbol; }
47
48 const GlobalValue *getGlobalValue() const { return GV; }
49 StringRef getSymbol() const { return S; }
50
52 Align Alignment) override;
53
55
56 void print(raw_ostream &O) const override;
57
58 bool equals(const RISCVConstantPoolValue *A) const;
59};
60
61} // end namespace llvm
62
63#endif
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
The address of a basic block.
Definition Constants.h:899
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition FoldingSet.h:330
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
A RISCV-specific constant pool value.
const GlobalValue * getGlobalValue() const
static RISCVConstantPoolValue * Create(const GlobalValue *GV)
bool equals(const RISCVConstantPoolValue *A) const
void print(raw_ostream &O) const override
print - Implement operator<<
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39