aboutsummaryrefslogtreecommitdiff
path: root/py/emitnthumb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-04-10 15:06:47 +1000
committerDamien George <damien.p.george@gmail.com>2018-04-10 15:06:47 +1000
commitef12a4bd05cdd531d9c130763ffb2470e9c0fb54 (patch)
tree94d7766955f9de3e3553e3f44afcd898aa7962cb /py/emitnthumb.c
parent5ad27d4b8bb248954d98178e068a382599dadfa6 (diff)
py: Refactor how native emitter code is compiled with a file per arch.
Instead of emitnative.c having configuration code for each supported architecture, and then compiling this file multiple times with different macros defined, this patch adds a file per architecture with the necessary code to configure the native emitter. These files then #include the emitnative.c file. This simplifies emitnative.c (which is already very large), and simplifies the build system because emitnative.c no longer needs special handling for compilation and qstr extraction.
Diffstat (limited to 'py/emitnthumb.c')
-rw-r--r--py/emitnthumb.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/py/emitnthumb.c b/py/emitnthumb.c
new file mode 100644
index 000000000..2b68ca3a1
--- /dev/null
+++ b/py/emitnthumb.c
@@ -0,0 +1,15 @@
+// thumb specific stuff
+
+#include "py/mpconfig.h"
+
+#if MICROPY_EMIT_THUMB
+
+// this is defined so that the assembler exports generic assembler API macros
+#define GENERIC_ASM_API (1)
+#include "py/asmthumb.h"
+
+#define N_THUMB (1)
+#define EXPORT_FUN(name) emit_native_thumb_##name
+#include "py/emitnative.c"
+
+#endif