tmp
authoryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 04:29:43 +0000 (12:29 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 04:29:43 +0000 (12:29 +0800)
ses_layout.c

index ccfe5c13dc54fc6d19eac5d8f74a0307199c08f6..54560323b7d946f8785fd0c23ce872817edb4475 100644 (file)
@@ -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];