aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/Target')
-rw-r--r--backend/lib/Target/RISCV/GISel/RISCVCallLowering.cpp2
-rw-r--r--backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp2
-rw-r--r--backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp18
-rw-r--r--backend/lib/Target/RISCV/RISCVMCTargetLowering.cpp10
4 files changed, 15 insertions, 17 deletions
diff --git a/backend/lib/Target/RISCV/GISel/RISCVCallLowering.cpp b/backend/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
index cfe8bb6..71c7251 100644
--- a/backend/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
+++ b/backend/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
@@ -781,7 +781,7 @@ RISCVCallLowering::planReturn(const ReturnLoweringRequest &Request) const {
[[nodiscard]] Expected<void> addUnsignedImmediate(MachineInstrBuilder &Builder,
std::uint64_t Value) {
- auto Immediate = IntegerImmediate::fromUnsigned(64, Value);
+ auto Immediate = APInt::fromUnsigned(64, Value);
if (!Immediate)
return std::unexpected(Immediate.error());
return Builder.addIntegerImmediate(std::move(*Immediate));
diff --git a/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp b/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
index a2c7194..2090496 100644
--- a/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
+++ b/backend/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp
@@ -2512,7 +2512,7 @@ private:
const std::uint32_t BitWidth = Type->scalarBitWidth();
const std::uint64_t Bits = Floating->Bits.words().empty() ? 0 : Floating->Bits.words().front();
- auto Integer = IntegerImmediate::fromUnsigned(64, Bits);
+ auto Integer = APInt::fromUnsigned(64, Bits);
if (!Integer)
return std::unexpected(Integer.error());
auto IntegerType = LLT::makeInteger(64);
diff --git a/backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index e9d72fd..da8d687 100644
--- a/backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -99,9 +99,8 @@ namespace {
Destination.scalarBitWidth() <= 64;
}
-[[nodiscard]] Expected<IntegerImmediate> extendIntegerImmediate(const IntegerImmediate &Value,
- std::uint32_t DestinationWidth,
- bool SignExtend) {
+[[nodiscard]] Expected<APInt>
+extendIntegerImmediate(const APInt &Value, std::uint32_t DestinationWidth, bool SignExtend) {
if (DestinationWidth == 0 || DestinationWidth > 64)
return makeUnexpected(ErrorCode::Unsupported,
"RISC-V constant extension requires a destination no wider than 64 bits");
@@ -112,7 +111,7 @@ namespace {
Raw |= ~std::uint64_t{0} << SourceWidth;
if (DestinationWidth < 64)
Raw &= (std::uint64_t{1} << DestinationWidth) - 1U;
- return IntegerImmediate::create(DestinationWidth, std::span<const std::uint64_t>(&Raw, 1));
+ return APInt::create(DestinationWidth, std::span<const std::uint64_t>(&Raw, 1));
}
[[nodiscard]] Expected<void>
@@ -271,9 +270,8 @@ wideConstantUnmergePlan(const MachineInstr &Constant, const MachineFunction &Fun
return Plan;
}
-[[nodiscard]] Expected<IntegerImmediate> wideConstantWord(const IntegerImmediate &Value,
- std::size_t WordIndex,
- std::uint32_t Width, bool SignExtend) {
+[[nodiscard]] Expected<APInt> wideConstantWord(const APInt &Value, std::size_t WordIndex,
+ std::uint32_t Width, bool SignExtend) {
std::uint64_t Raw = 0;
if (WordIndex < Value.words().size())
Raw = Value.words()[WordIndex];
@@ -287,7 +285,7 @@ wideConstantUnmergePlan(const MachineInstr &Constant, const MachineFunction &Fun
}
if (Width < 64)
Raw &= (std::uint64_t{1} << Width) - 1U;
- return IntegerImmediate::create(Width, std::span<const std::uint64_t>(&Raw, 1));
+ return APInt::create(Width, std::span<const std::uint64_t>(&Raw, 1));
}
[[nodiscard]] Expected<void> foldWideConstant(MachineInstr &Instruction, MachineFunction &Function,
@@ -303,7 +301,7 @@ wideConstantUnmergePlan(const MachineInstr &Constant, const MachineFunction &Fun
return makeUnexpected(ErrorCode::VerificationError,
"RISC-V wide constant has no integer immediate");
- std::vector<IntegerImmediate> Words;
+ std::vector<APInt> Words;
Words.reserve(Plan->Outputs.size());
for (std::size_t Index = 0; Index < Plan->Outputs.size(); ++Index) {
const auto Info = Function.registerInfo().virtualRegisterInfo(Plan->Outputs[Index]);
@@ -1240,7 +1238,7 @@ void eraseDeadArtifacts(std::span<MachineInstr *const> Candidates,
auto Result = Builder.function().registerInfo().createVirtualRegister(*Type);
if (!Result)
return std::unexpected(Result.error());
- auto Immediate = IntegerImmediate::fromUnsigned(Width, Value);
+ auto Immediate = APInt::fromUnsigned(Width, Value);
if (!Immediate)
return std::unexpected(Immediate.error());
auto Point = Builder.setInsertPointBefore(Anchor);
diff --git a/backend/lib/Target/RISCV/RISCVMCTargetLowering.cpp b/backend/lib/Target/RISCV/RISCVMCTargetLowering.cpp
index ee41d47..0db51f0 100644
--- a/backend/lib/Target/RISCV/RISCVMCTargetLowering.cpp
+++ b/backend/lib/Target/RISCV/RISCVMCTargetLowering.cpp
@@ -252,7 +252,7 @@ struct TypeLayout final {
return mc::MCOperand::expression(std::move(*TargetExpression));
}
-[[nodiscard]] Expected<std::int64_t> lowerIntegerImmediate(const IntegerImmediate &Value) {
+[[nodiscard]] Expected<std::int64_t> lowerIntegerImmediate(const APInt &Value) {
if (Value.bitWidth() > 64 || Value.words().size() != 1) {
return makeUnexpected(ErrorCode::AssemblyLoweringFailed,
"RISC-V instruction has an integer immediate wider than 64 bits");
@@ -714,14 +714,14 @@ struct TypeLayout final {
}
switch (Initializer.kind()) {
case GlobalInitializer::Kind::Integer: {
- const auto *Value = Initializer.getIf<IntegerImmediate>();
+ const auto *Value = Initializer.getIf<APInt>();
if (Value == nullptr)
return makeUnexpected(ErrorCode::InternalError, "integer initializer has no value");
const std::uint64_t Size = (static_cast<std::uint64_t>(Value->bitWidth()) + 7U) / 8U;
return Streamer.emitBytes(bytesFromWords(Value->words(), Size));
}
case GlobalInitializer::Kind::Floating: {
- const auto *Value = Initializer.getIf<FloatingPointBits>();
+ const auto *Value = Initializer.getIf<APFloat>();
if (Value == nullptr)
return makeUnexpected(ErrorCode::InternalError, "floating initializer has no value");
const std::uint64_t Size = (static_cast<std::uint64_t>(Value->bitWidth()) + 7U) / 8U;
@@ -839,12 +839,12 @@ struct TypeLayout final {
return false;
switch (Initializer.kind()) {
case GlobalInitializer::Kind::Integer: {
- const auto *Value = Initializer.getIf<IntegerImmediate>();
+ const auto *Value = Initializer.getIf<APInt>();
return Value != nullptr &&
std::ranges::all_of(Value->words(), [](std::uint64_t Word) { return Word == 0; });
}
case GlobalInitializer::Kind::Floating: {
- const auto *Value = Initializer.getIf<FloatingPointBits>();
+ const auto *Value = Initializer.getIf<APFloat>();
return Value != nullptr &&
std::ranges::all_of(Value->words(), [](std::uint64_t Word) { return Word == 0; });
}