aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVImmediateMaterialization.h
blob: 99d387600e5bb3fb1d634915a3e706ef053f12ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_LIB_TARGET_RISCV_RISCVIMMEDIATEMATERIALIZATION_H
#define RCC_LIB_TARGET_RISCV_RISCVIMMEDIATEMATERIALIZATION_H

#include <cstddef>
#include <cstdint>

namespace rcc::riscv {

inline constexpr std::size_t DefaultRV64IntegerBuildCost = 5;

[[nodiscard]] std::size_t estimateRV64IntegerBuildCost(std::int64_t Value) noexcept;

[[nodiscard]] bool
shouldUseRV64IntegerConstantPool(
    std::int64_t Value,
    std::size_t MaximumBuildCost = DefaultRV64IntegerBuildCost) noexcept;

} // namespace rcc::riscv

#endif // RCC_LIB_TARGET_RISCV_RISCVIMMEDIATEMATERIALIZATION_H