[llvm] [RFC][RISCV] Support the large code model. (PR #70308)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 02:32:32 PDT 2023


================
@@ -0,0 +1,114 @@
+//===------- RISCVConstantPoolValue.cpp - RISC-V constantpool value -------===//
+//
+// 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 implements the RISC-V specific constantpool value class.
+//
+//===----------------------------------------------------------------------===//
+
+#include "RISCVConstantPoolValue.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/Type.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+RISCVConstantPoolValue::RISCVConstantPoolValue(
+    LLVMContext &C, RISCVCP::RISCVCPKind Kind,
+    RISCVCP::RISCVCPModifier Modifier)
+    : MachineConstantPoolValue((Type *)Type::getInt64Ty(C)), Kind(Kind),
+      Modifier(Modifier) {}
+
+RISCVConstantPoolValue::RISCVConstantPoolValue(
+    Type *Ty, RISCVCP::RISCVCPKind Kind, RISCVCP::RISCVCPModifier Modifier)
+    : MachineConstantPoolValue(Ty), Kind(Kind), Modifier(Modifier) {}
+
+int RISCVConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
+                                                      Align Alignment) {
+  llvm_unreachable("Shouldn't be calling this directly!");
+}
+
+StringRef RISCVConstantPoolValue::getModifierText() const {
+  switch (Modifier) {
+  case RISCVCP::None:
+    return "";
+  }
+  llvm_unreachable("Unknown modifier!");
+}
+
+void RISCVConstantPoolValue::print(raw_ostream &O) const {
+  if (hasModifier())
+    O << "@" << getModifierText();
----------------
wangpc-pp wrote:

Do we need this? The `Modifier` will always be `None`.

https://github.com/llvm/llvm-project/pull/70308


More information about the llvm-commits mailing list