summaryrefslogtreecommitdiff
path: root/py/asmarm.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-02-27 15:32:29 +1100
committerDamien George <damien@micropython.org>2024-03-07 14:20:42 +1100
commitdecf8e6a8bb940d5829ca3296790631fcece7b21 (patch)
tree55b7cd31de14b73e4b72d49344e9084f402767a9 /py/asmarm.c
parentb3f2f18f927fa2fad10daf63d8c391331f5edf58 (diff)
all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit d5df6cd44a433d6253a61cb0f987835fbc06b2de. The original reason for this was to have the option to define it to nothing so that all static functions become global functions and therefore visible to certain debug tools, so one could do function size comparison and other things. This STATIC feature is rarely (if ever) used. And with the use of LTO and heavy inline optimisation, analysing the size of individual functions when they are not static is not a good representation of the size of code when fully optimised. So the macro does not have much use and it's simpler to just remove it. Then you know exactly what it's doing. For example, newcomers don't have to learn what the STATIC macro is and why it exists. Reading the code is also less "loud" with a lowercase static. One other minor point in favour of removing it, is that it stops bugs with `STATIC inline`, which should always be `static inline`. Methodology for this commit was: 1) git ls-files | egrep '\.[ch]$' | \ xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/" 2) Do some manual cleanup in the diff by searching for the word STATIC in comments and changing those back. 3) "git-grep STATIC docs/", manually fixed those cases. 4) "rg -t python STATIC", manually fixed codegen lines that used STATIC. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/asmarm.c')
-rw-r--r--py/asmarm.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index 42724e4d4..cd346949e 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -39,7 +39,7 @@
#define SIGNED_FIT24(x) (((x) & 0xff800000) == 0) || (((x) & 0xff000000) == 0xff000000)
// Insert word into instruction flow
-STATIC void emit(asm_arm_t *as, uint op) {
+static void emit(asm_arm_t *as, uint op) {
uint8_t *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 4);
if (c != NULL) {
*(uint32_t *)c = op;
@@ -47,73 +47,73 @@ STATIC void emit(asm_arm_t *as, uint op) {
}
// Insert word into instruction flow, add "ALWAYS" condition code
-STATIC void emit_al(asm_arm_t *as, uint op) {
+static void emit_al(asm_arm_t *as, uint op) {
emit(as, op | ASM_ARM_CC_AL);
}
// Basic instructions without condition code
-STATIC uint asm_arm_op_push(uint reglist) {
+static uint asm_arm_op_push(uint reglist) {
// stmfd sp!, {reglist}
return 0x92d0000 | (reglist & 0xFFFF);
}
-STATIC uint asm_arm_op_pop(uint reglist) {
+static uint asm_arm_op_pop(uint reglist) {
// ldmfd sp!, {reglist}
return 0x8bd0000 | (reglist & 0xFFFF);
}
-STATIC uint asm_arm_op_mov_reg(uint rd, uint rn) {
+static uint asm_arm_op_mov_reg(uint rd, uint rn) {
// mov rd, rn
return 0x1a00000 | (rd << 12) | rn;
}
-STATIC uint asm_arm_op_mov_imm(uint rd, uint imm) {
+static uint asm_arm_op_mov_imm(uint rd, uint imm) {
// mov rd, #imm
return 0x3a00000 | (rd << 12) | imm;
}
-STATIC uint asm_arm_op_mvn_imm(uint rd, uint imm) {
+static uint asm_arm_op_mvn_imm(uint rd, uint imm) {
// mvn rd, #imm
return 0x3e00000 | (rd << 12) | imm;
}
-STATIC uint asm_arm_op_add_imm(uint rd, uint rn, uint imm) {
+static uint asm_arm_op_add_imm(uint rd, uint rn, uint imm) {
// add rd, rn, #imm
return 0x2800000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
}
-STATIC uint asm_arm_op_add_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_add_reg(uint rd, uint rn, uint rm) {
// add rd, rn, rm
return 0x0800000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
+static uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
// sub rd, rn, #imm
return 0x2400000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
}
-STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
// sub rd, rn, rm
return 0x0400000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_mul_reg(uint rd, uint rm, uint rs) {
+static uint asm_arm_op_mul_reg(uint rd, uint rm, uint rs) {
// mul rd, rm, rs
assert(rd != rm);
return 0x0000090 | (rd << 16) | (rs << 8) | rm;
}
-STATIC uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
// and rd, rn, rm
return 0x0000000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
// eor rd, rn, rm
return 0x0200000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
// orr rd, rn, rm
return 0x1800000 | (rn << 16) | (rd << 12) | rm;
}