From 496e46a8f730eb76a001d3bf09a5316e033bace5 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 8 Nov 2023 12:29:43 +0800 Subject: [PATCH] tmp --- ses_layout.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index ccfe5c1..5456032 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -558,7 +558,7 @@ static inline void eline_mov_before(ScfEfunction* f, intptr_t dst, intptr_t src) int _topo_print(scf_vector_t* paths); -static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base) +static void __ses_layout_path2(ScfEfunction* f, ses_path_t* path, ses_path_t* base) { ScfEcomponent* c; ScfEline* el; @@ -580,6 +580,8 @@ static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* bas for (j = path->pins->size - 1; j > 0; j -= 2) { p = path->pins->data[j]; + scf_logi("path: %d, c%ldp%ld, __n: %ld, l%ld\n", path->index, p->cid, p->id, __n, f->elines[__n]->id); + for (k = base->pins->size - 1; k >= 0; k--) { bp = base->pins->data[k]; @@ -616,11 +618,15 @@ static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* bas p = path->pins->data[0]; + scf_logi("path: %d, c%ldp%ld, __n: %ld, l%ld\n", path->index, p->cid, p->id, __n, f->elines[__n]->id); + for (k = base->pins->size - 1; k >= 0; k--) { bp = base->pins->data[k]; if (p->lid == bp->lid) { __n = __ses_find_eline_index(f, bp->lid); + + scf_logw("__n: %ld, l%ld\n", __n, f->elines[__n]->id); break; } } @@ -645,26 +651,35 @@ static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* bas eline_mov_before(f, __n, n); } printf("\n"); +} - base = path; +static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base) +{ + intptr_t i; + + if (path != base) { + __ses_layout_path2(f, path, base); + + base = path; + } if (base->childs) { - for (j = 0; j < base->childs->size; j++) { - path = base->childs->data[j]; + for (i = 0; i < base->childs->size; i++) { + path = base->childs->data[i]; __ses_layout_path(f, path, base); } } if (base->bridges) { - for (j = 0; j < base->bridges->size; j++) { - path = base->bridges->data[j]; + for (i = 0; i < base->bridges->size; i++) { + path = base->childs->data[i]; __ses_layout_path(f, path, base); } } - scf_loge("path: %d\n\n", path->index); + scf_logi("path: %d, ------------------------\n\n", base->index); } static int __ses_layout_lines4(ScfEfunction* f) @@ -680,7 +695,6 @@ static int __ses_layout_lines4(ScfEfunction* f) intptr_t i; intptr_t j; - intptr_t k; intptr_t n; intptr_t __n; @@ -720,10 +734,9 @@ static int __ses_layout_lines4(ScfEfunction* f) p = base->pins->data[j - 1]; n = __ses_find_eline_index(f, p->lid); - SCF_XCHG(f->elines[n], f->elines[j / 2 + 1]); - scf_logd("j: %ld, l%ld\n", j / 2 + 1, f->elines[j / 2 + 1]->id); + __ses_layout_path(f, base, base); for (i = 0; i < paths->size; i++) { path = paths->data[i]; -- 2.25.1