CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
91 lines
3.0 KiB
C++
91 lines
3.0 KiB
C++
//===-- RISCVMCExpr.cpp - RISC-V specific MC expression classes -----------===//
|
|
//
|
|
// 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 implementation of the assembly expression modifiers
|
|
// accepted by the RISC-V architecture (e.g. ":lo12:", ":gottprel_g1:", ...).
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MCTargetDesc/RISCVAsmBackend.h"
|
|
#include "MCTargetDesc/RISCVMCAsmInfo.h"
|
|
#include "llvm/BinaryFormat/ELF.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
using namespace llvm;
|
|
|
|
#define DEBUG_TYPE "riscvmcexpr"
|
|
|
|
RISCV::Specifier RISCV::parseSpecifierName(StringRef name) {
|
|
return StringSwitch<RISCV::Specifier>(name)
|
|
.Case("lo", RISCV::S_LO)
|
|
.Case("hi", ELF::R_RISCV_HI20)
|
|
.Case("pcrel_lo", RISCV::S_PCREL_LO)
|
|
.Case("pcrel_hi", RISCV::S_PCREL_HI)
|
|
.Case("got_pcrel_hi", RISCV::S_GOT_HI)
|
|
.Case("tprel_lo", RISCV::S_TPREL_LO)
|
|
.Case("tprel_hi", ELF::R_RISCV_TPREL_HI20)
|
|
.Case("tprel_add", ELF::R_RISCV_TPREL_ADD)
|
|
.Case("tls_ie_pcrel_hi", ELF::R_RISCV_TLS_GOT_HI20)
|
|
.Case("tls_gd_pcrel_hi", ELF::R_RISCV_TLS_GD_HI20)
|
|
.Case("tlsdesc_hi", ELF::R_RISCV_TLSDESC_HI20)
|
|
.Case("tlsdesc_load_lo", ELF::R_RISCV_TLSDESC_LOAD_LO12)
|
|
.Case("tlsdesc_add_lo", ELF::R_RISCV_TLSDESC_ADD_LO12)
|
|
.Case("tlsdesc_call", ELF::R_RISCV_TLSDESC_CALL)
|
|
.Case("qc.abs20", RISCV::S_QC_ABS20)
|
|
// Used in data directives
|
|
.Case("pltpcrel", ELF::R_RISCV_PLT32)
|
|
.Case("gotpcrel", ELF::R_RISCV_GOT32_PCREL)
|
|
.Default(0);
|
|
}
|
|
|
|
StringRef RISCV::getSpecifierName(Specifier S) {
|
|
switch (S) {
|
|
case RISCV::S_None:
|
|
llvm_unreachable("not used as %specifier()");
|
|
case RISCV::S_LO:
|
|
return "lo";
|
|
case ELF::R_RISCV_HI20:
|
|
return "hi";
|
|
case RISCV::S_PCREL_LO:
|
|
return "pcrel_lo";
|
|
case RISCV::S_PCREL_HI:
|
|
return "pcrel_hi";
|
|
case RISCV::S_GOT_HI:
|
|
return "got_pcrel_hi";
|
|
case RISCV::S_TPREL_LO:
|
|
return "tprel_lo";
|
|
case ELF::R_RISCV_TPREL_HI20:
|
|
return "tprel_hi";
|
|
case ELF::R_RISCV_TPREL_ADD:
|
|
return "tprel_add";
|
|
case ELF::R_RISCV_TLS_GOT_HI20:
|
|
return "tls_ie_pcrel_hi";
|
|
case ELF::R_RISCV_TLSDESC_HI20:
|
|
return "tlsdesc_hi";
|
|
case ELF::R_RISCV_TLSDESC_LOAD_LO12:
|
|
return "tlsdesc_load_lo";
|
|
case ELF::R_RISCV_TLSDESC_ADD_LO12:
|
|
return "tlsdesc_add_lo";
|
|
case ELF::R_RISCV_TLSDESC_CALL:
|
|
return "tlsdesc_call";
|
|
case ELF::R_RISCV_TLS_GD_HI20:
|
|
return "tls_gd_pcrel_hi";
|
|
case RISCV::S_CALL_PLT:
|
|
return "call_plt";
|
|
case ELF::R_RISCV_32_PCREL:
|
|
return "32_pcrel";
|
|
case ELF::R_RISCV_GOT32_PCREL:
|
|
return "gotpcrel";
|
|
case ELF::R_RISCV_PLT32:
|
|
return "pltpcrel";
|
|
case RISCV::S_QC_ABS20:
|
|
return "qc.abs20";
|
|
}
|
|
llvm_unreachable("Invalid ELF symbol kind");
|
|
}
|