Path: blob/main/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVConstantPoolValue.h
213799 views
//===--- RISCVConstantPoolValue.h - RISC-V constantpool value ---*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file implements the RISC-V specific constantpool value class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_RISCV_RISCVCONSTANTPOOLVALUE_H13#define LLVM_LIB_TARGET_RISCV_RISCVCONSTANTPOOLVALUE_H1415#include "llvm/ADT/StringRef.h"16#include "llvm/CodeGen/MachineConstantPool.h"17#include "llvm/Support/Casting.h"18#include "llvm/Support/ErrorHandling.h"1920namespace llvm {2122class BlockAddress;23class GlobalValue;24class LLVMContext;2526/// A RISCV-specific constant pool value.27class RISCVConstantPoolValue : public MachineConstantPoolValue {28const GlobalValue *GV;29const StringRef S;3031RISCVConstantPoolValue(Type *Ty, const GlobalValue *GV);32RISCVConstantPoolValue(LLVMContext &C, StringRef S);3334private:35enum class RISCVCPKind { ExtSymbol, GlobalValue };36RISCVCPKind Kind;3738public:39~RISCVConstantPoolValue() = default;4041static RISCVConstantPoolValue *Create(const GlobalValue *GV);42static RISCVConstantPoolValue *Create(LLVMContext &C, StringRef S);4344bool isGlobalValue() const { return Kind == RISCVCPKind::GlobalValue; }45bool isExtSymbol() const { return Kind == RISCVCPKind::ExtSymbol; }4647const GlobalValue *getGlobalValue() const { return GV; }48StringRef getSymbol() const { return S; }4950int getExistingMachineCPValue(MachineConstantPool *CP,51Align Alignment) override;5253void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;5455void print(raw_ostream &O) const override;5657bool equals(const RISCVConstantPoolValue *A) const;58};5960} // end namespace llvm6162#endif636465