aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVImmediateMaterialization.h
blob: e38f75231550891ccc1943ddd7504016c801ce63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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