summaryrefslogtreecommitdiff
path: root/src/trans/allocator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans/allocator.hpp')
-rw-r--r--src/trans/allocator.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/trans/allocator.hpp b/src/trans/allocator.hpp
new file mode 100644
index 00000000..67d56c11
--- /dev/null
+++ b/src/trans/allocator.hpp
@@ -0,0 +1,32 @@
+/*
+ */
+#include <cstddef>
+
+enum class AllocatorDataTy {
+ // - Return
+ Never, // !
+ Unit, // ()
+ ResultPtr, // (..., *mut i8) + *mut u8
+ ResultExcess, // (..., *mut i8, *mut i8) + *mut u8
+ UsizePair, // (..., *mut usize, *mut usize) + ()
+ ResultUnit, // i8
+ // - Args
+ Layout, // usize, usize
+ LayoutRef, // *const Layout [actually *const i8]
+ AllocError, // *const i8
+ Ptr, // *mut u8
+};
+struct AllocatorMethod {
+ const char* name;
+ AllocatorDataTy ret;
+ size_t n_args;
+ const AllocatorDataTy* args; // Terminated by Never
+};
+enum class AllocatorKind {
+ Global,
+ DefaultLib,
+ DefaultExe,
+};
+
+extern const AllocatorMethod ALLOCATOR_METHODS[10];
+