Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
25d90410
Commit
25d90410
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Adjust regs for x86 so that 1 more local can live in a reg.
parent
91fe0d48
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/asmx86.c
+3
-1
3 additions, 1 deletion
py/asmx86.c
py/asmx86.h
+1
-1
1 addition, 1 deletion
py/asmx86.h
py/emitnative.c
+14
-5
14 additions, 5 deletions
py/emitnative.c
with
18 additions
and
7 deletions
py/asmx86.c
+
3
−
1
View file @
25d90410
...
@@ -413,7 +413,9 @@ void asm_x86_jcc_label(asm_x86_t *as, mp_uint_t jcc_type, mp_uint_t label) {
...
@@ -413,7 +413,9 @@ void asm_x86_jcc_label(asm_x86_t *as, mp_uint_t jcc_type, mp_uint_t label) {
void
asm_x86_entry
(
asm_x86_t
*
as
,
mp_uint_t
num_locals
)
{
void
asm_x86_entry
(
asm_x86_t
*
as
,
mp_uint_t
num_locals
)
{
asm_x86_push_r32
(
as
,
REG_EBP
);
asm_x86_push_r32
(
as
,
REG_EBP
);
asm_x86_mov_r32_to_r32
(
as
,
REG_ESP
,
REG_EBP
);
asm_x86_mov_r32_to_r32
(
as
,
REG_ESP
,
REG_EBP
);
asm_x86_sub_i32_from_r32
(
as
,
num_locals
*
WORD_SIZE
,
REG_ESP
);
if
(
num_locals
>
0
)
{
asm_x86_sub_i32_from_r32
(
as
,
num_locals
*
WORD_SIZE
,
REG_ESP
);
}
asm_x86_push_r32
(
as
,
REG_EBX
);
asm_x86_push_r32
(
as
,
REG_EBX
);
asm_x86_push_r32
(
as
,
REG_ESI
);
asm_x86_push_r32
(
as
,
REG_ESI
);
asm_x86_push_r32
(
as
,
REG_EDI
);
asm_x86_push_r32
(
as
,
REG_EDI
);
...
...
This diff is collapsed.
Click to expand it.
py/asmx86.h
+
1
−
1
View file @
25d90410
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
#define ASM_X86_CC_JL (0xc) // less, signed
#define ASM_X86_CC_JL (0xc) // less, signed
#define REG_RET REG_EAX
#define REG_RET REG_EAX
#define REG_ARG_1 REG_E
B
X
#define REG_ARG_1 REG_E
A
X
#define REG_ARG_2 REG_ECX
#define REG_ARG_2 REG_ECX
#define REG_ARG_3 REG_EDX
#define REG_ARG_3 REG_EDX
...
...
This diff is collapsed.
Click to expand it.
py/emitnative.c
+
14
−
5
View file @
25d90410
...
@@ -189,13 +189,16 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
...
@@ -189,13 +189,16 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
#define EXPORT_FUN(name) emit_native_x86_##name
#define EXPORT_FUN(name) emit_native_x86_##name
// caller-save, so can be used as temporaries
#define REG_TEMP0 (REG_EAX)
#define REG_TEMP0 (REG_EAX)
#define REG_TEMP1 (REG_E
B
X)
#define REG_TEMP1 (REG_E
C
X)
#define REG_TEMP2 (REG_E
C
X)
#define REG_TEMP2 (REG_E
D
X)
#define REG_LOCAL_1 (REG_ESI)
// callee-save, so can be used as locals
#define REG_LOCAL_2 (REG_EDI)
#define REG_LOCAL_1 (REG_EBX)
#define REG_LOCAL_NUM (2)
#define REG_LOCAL_2 (REG_ESI)
#define REG_LOCAL_3 (REG_EDI)
#define REG_LOCAL_NUM (3)
#define ASM_PASS_COMPUTE ASM_X86_PASS_COMPUTE
#define ASM_PASS_COMPUTE ASM_X86_PASS_COMPUTE
#define ASM_PASS_EMIT ASM_X86_PASS_EMIT
#define ASM_PASS_EMIT ASM_X86_PASS_EMIT
...
@@ -528,6 +531,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
...
@@ -528,6 +531,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_LOCAL_1
);
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_LOCAL_1
);
}
else
if
(
i
==
1
)
{
}
else
if
(
i
==
1
)
{
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_LOCAL_2
);
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_LOCAL_2
);
}
else
if
(
i
==
2
)
{
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_LOCAL_3
);
}
else
{
}
else
{
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_TEMP0
);
asm_x86_mov_arg_to_r32
(
emit
->
as
,
i
,
REG_TEMP0
);
asm_x86_mov_r32_to_local
(
emit
->
as
,
REG_TEMP0
,
i
-
REG_LOCAL_NUM
);
asm_x86_mov_r32_to_local
(
emit
->
as
,
REG_TEMP0
,
i
-
REG_LOCAL_NUM
);
...
@@ -1022,6 +1027,8 @@ STATIC void emit_native_load_fast(emit_t *emit, qstr qstr, uint id_flags, int lo
...
@@ -1022,6 +1027,8 @@ STATIC void emit_native_load_fast(emit_t *emit, qstr qstr, uint id_flags, int lo
emit_post_push_reg
(
emit
,
vtype
,
REG_LOCAL_1
);
emit_post_push_reg
(
emit
,
vtype
,
REG_LOCAL_1
);
}
else
if
(
local_num
==
1
)
{
}
else
if
(
local_num
==
1
)
{
emit_post_push_reg
(
emit
,
vtype
,
REG_LOCAL_2
);
emit_post_push_reg
(
emit
,
vtype
,
REG_LOCAL_2
);
}
else
if
(
local_num
==
2
)
{
emit_post_push_reg
(
emit
,
vtype
,
REG_LOCAL_3
);
}
else
{
}
else
{
need_reg_single
(
emit
,
REG_EAX
,
0
);
need_reg_single
(
emit
,
REG_EAX
,
0
);
asm_x86_mov_local_to_r32
(
emit
->
as
,
local_num
-
REG_LOCAL_NUM
,
REG_EAX
);
asm_x86_mov_local_to_r32
(
emit
->
as
,
local_num
-
REG_LOCAL_NUM
,
REG_EAX
);
...
@@ -1125,6 +1132,8 @@ STATIC void emit_native_store_fast(emit_t *emit, qstr qstr, int local_num) {
...
@@ -1125,6 +1132,8 @@ STATIC void emit_native_store_fast(emit_t *emit, qstr qstr, int local_num) {
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_LOCAL_1
);
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_LOCAL_1
);
}
else
if
(
local_num
==
1
)
{
}
else
if
(
local_num
==
1
)
{
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_LOCAL_2
);
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_LOCAL_2
);
}
else
if
(
local_num
==
2
)
{
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_LOCAL_3
);
}
else
{
}
else
{
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_EAX
);
emit_pre_pop_reg
(
emit
,
&
vtype
,
REG_EAX
);
asm_x86_mov_r32_to_local
(
emit
->
as
,
REG_EAX
,
local_num
-
REG_LOCAL_NUM
);
asm_x86_mov_r32_to_local
(
emit
->
as
,
REG_EAX
,
local_num
-
REG_LOCAL_NUM
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment