From mboxrd@z Thu Jan 1 00:00:00 1970 From: newsham@lava.net (Tim Newsham) Date: Tue, 20 May 2008 09:49:09 -1000 (HST) Subject: [Unix-jun72] status on disassembler In-Reply-To: <20080520051628.379B75A525@remarque.org> References: <20080520051628.379B75A525@remarque.org> Message-ID: > My first approach to "temporary labels" (1f/1b, see Knuth) failed badly; > if anyone has insights on how such things should be disassembled, > please tell me; I'm still mentally going through various possible > algorithms. This is a standard register allocation problem (ie. assigning registers to variables when compiling a program). You need to figure out over which ranges of the program the labels are "live". Then you need to figure out which ones are live at the same time and build a graph of which labels cannot share the same label. Then you go through and start assigning labels in a way that fits this constraint. http://en.wikipedia.org/wiki/Register_allocation http://en.wikipedia.org/wiki/Graph_coloring Should be covered in compilers text books. > Doug Tim Newsham http://www.thenewsh.com/~newsham/