Changeset f1fb1d1 in mainline


Ignore:
Timestamp:
2009-09-17T00:01:46Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0e8ad0b
Parents:
51d4040
Message:

flattening of bindings has to be done interatively until there is anything left

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/arch/hadlbppp.py

    r51d4040 rf1fb1d1  
    422422        outf.close()
    423423
     424def flatten_binds(binds, delegates, subsumes):
     425        "Remove bindings which are replaced by delegation or subsumption"
     426       
     427        result = []
     428        stable = True
     429       
     430        for bind in binds:
     431                keep = True
     432               
     433                for delegate in delegates:
     434                        if (bind['to'] == delegate['to']):
     435                                keep = False
     436                                result.append({'from': bind['from'], 'to': delegate['rep']})
     437               
     438                for subsume in subsumes:
     439                        if (bind['from'] == subsume['from']):
     440                                keep = False
     441                                result.append({'from': subsume['rep'], 'to': bind['to']})
     442               
     443                if (keep):
     444                        result.append(bind)
     445                else:
     446                        stable = False
     447       
     448        if (stable):
     449                return result
     450        else:
     451                return flatten_binds(result, delegates, subsumes)
     452
    424453def merge_subarch(prefix, arch, outdir):
    425454        "Merge subarchitecture into architexture"
     
    512541                dump_frame(inst['frame'], outdir, inst['var'], outf)
    513542       
    514         for bind in binds:
    515                 for delegate in delegates:
    516                         if (bind['to'] == delegate['to']):
    517                                 bind['to'] = delegate['rep']
    518                                 break
    519                
    520                 for subsume in subsumes:
    521                         if (bind['from'] == subsume['from']):
    522                                 bind['from'] = subsume['rep']
    523                                 break
    524                
     543        for bind in flatten_binds(binds, delegates, subsumes):
    525544                outf.write("bind %s to %s\n" % (bind['from'], bind['to']))
    526545       
Note: See TracChangeset for help on using the changeset viewer.