aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/MC/MCCFI.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-09 18:31:49 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-09 18:31:49 +0800
commit379ff50dcc7ccf977379aee68fa9d10f69065d23 (patch)
treee0fac3952d46d0bbcaea32bcfc6087c95fff2992 /backend/include/rcc/MC/MCCFI.h
parent495c675771f43cfa12ab7a426a538be72fec1805 (diff)
downloadrcc-project-379ff50dcc7ccf977379aee68fa9d10f69065d23.tar.gz
rcc-project-379ff50dcc7ccf977379aee68fa9d10f69065d23.tar.xz
[MC] Implement RV64GC assembly emission
Diffstat (limited to 'backend/include/rcc/MC/MCCFI.h')
-rw-r--r--backend/include/rcc/MC/MCCFI.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/backend/include/rcc/MC/MCCFI.h b/backend/include/rcc/MC/MCCFI.h
new file mode 100644
index 0000000..e6ac396
--- /dev/null
+++ b/backend/include/rcc/MC/MCCFI.h
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef RCC_MC_MCCFI_H
+#define RCC_MC_MCCFI_H
+
+#include "rcc/MC/MCSymbol.h"
+#include "rcc/Support/Error.h"
+
+#include <cstdint>
+#include <vector>
+
+namespace rcc::mc {
+
+enum class MCCFIOperation : std::uint8_t {
+ StartProc,
+ EndProc,
+ Sections,
+ Personality,
+ LSDA,
+ SignalFrame,
+ ReturnColumn,
+ SameValue,
+ RememberState,
+ RestoreState,
+ Offset,
+ DefCFARegister,
+ DefCFAOffset,
+ DefCFA,
+ RelativeOffset,
+ AdjustCFAOffset,
+ Escape,
+ Restore,
+ Undefined,
+ Register,
+ WindowSave,
+ NegateReturnAddressState,
+ NegateReturnAddressStateWithPC,
+ GNUArgsSize,
+ Label,
+ ValueOffset,
+};
+
+struct MCCFIInstruction final {
+ MCCFIOperation Operation = MCCFIOperation::StartProc;
+ std::vector<std::int64_t> Operands;
+ std::vector<std::uint8_t> Bytes;
+ MCSymbolRef Symbol;
+
+ [[nodiscard]] Expected<void> verify() const;
+};
+
+} // namespace rcc::mc
+
+#endif // RCC_MC_MCCFI_H