aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/CodeGen/GenericConstant.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 06:52:15 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 06:52:15 +0800
commitaa7c85ca71859aab15bdf1e6dc1ea3a5aa5d1e28 (patch)
tree20d94c4debfe4900e362c6c7f8443bcfbd58ec28 /backend/include/rcc/CodeGen/GenericConstant.h
parentd62f022c92fcc3ebe2269273628943a0089683fd (diff)
downloadrcc-project-aa7c85ca71859aab15bdf1e6dc1ea3a5aa5d1e28.tar.gz
rcc-project-aa7c85ca71859aab15bdf1e6dc1ea3a5aa5d1e28.tar.xz
[Support] Split APInt and APFloat ownership
Diffstat (limited to 'backend/include/rcc/CodeGen/GenericConstant.h')
-rw-r--r--backend/include/rcc/CodeGen/GenericConstant.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/backend/include/rcc/CodeGen/GenericConstant.h b/backend/include/rcc/CodeGen/GenericConstant.h
index 92a8f13..4219c24 100644
--- a/backend/include/rcc/CodeGen/GenericConstant.h
+++ b/backend/include/rcc/CodeGen/GenericConstant.h
@@ -3,8 +3,9 @@
#ifndef RCC_CODEGEN_GENERICCONSTANT_H
#define RCC_CODEGEN_GENERICCONSTANT_H
+#include "rcc/ADT/APFloat.h"
+#include "rcc/ADT/APInt.h"
#include "rcc/CodeGen/LowLevelType.h"
-#include "rcc/CodeGen/MachineOperand.h"
#include "rcc/Support/Error.h"
#include <cstddef>
@@ -144,8 +145,8 @@ private:
struct GenericConstantData final {
GenericConstantType Type;
GenericConstantKind Kind = GenericConstantKind::Invalid;
- std::optional<IntegerImmediate> IntegerValue;
- std::optional<FloatingPointBits> FloatingValue;
+ std::optional<APInt> IntegerValue;
+ std::optional<APFloat> FloatingValue;
std::vector<std::byte> ByteValue;
std::vector<GenericConstantData> Elements;
std::string Symbol;
@@ -155,11 +156,11 @@ struct GenericConstantData final {
GenericConstantExpressionOpcode ExpressionOpcode = GenericConstantExpressionOpcode::Invalid;
GenericConstantExpressionFlags ExpressionFlags;
std::optional<GenericConstantType> SourceElementType;
- std::optional<IntegerImmediate> InRangeStart;
- std::optional<IntegerImmediate> InRangeEnd;
+ std::optional<APInt> InRangeStart;
+ std::optional<APInt> InRangeEnd;
- [[nodiscard]] static Expected<GenericConstantData> integer(IntegerImmediate Value);
- [[nodiscard]] static Expected<GenericConstantData> floating(FloatingPointBits Value);
+ [[nodiscard]] static Expected<GenericConstantData> integer(APInt Value);
+ [[nodiscard]] static Expected<GenericConstantData> floating(APFloat Value);
[[nodiscard]] static Expected<GenericConstantData> byteString(GenericConstantType Type,
std::vector<std::byte> Bytes);