Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: Maximal Munch instruction selection: how to connect tiles? Date: Tue, 29 Sep 2015 17:16:27 +0200 Organization: Compilers Central Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-09-026@comp.compilers> References: <15-09-024@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: miucha.iecc.com 1443541993 67504 2001:470:1f07:1126:0:676f:7373:6970 (29 Sep 2015 15:53:13 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Tue, 29 Sep 2015 15:53:13 +0000 (UTC) Keywords: code, optimize Posted-Date: 29 Sep 2015 11:53:13 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1621 CC)sar schrieb: > Given the expression a = b + c; my compiler currently produces the > following IR-tree: > > = > / \ > a + (_t1) > / \ > b c > ... > I am trying to use the maximal munch strategy to produce assembly code > for this tree but I'm stuck with the following questions: ... You can consider many more cases, like the x86 addressing modes with base, index and scaling, which can be used for some arithmetic expressions in general. In case the '+' operator stores the result in memory, a '+=' opcode (add to memory) could be used in above expression. All that can end up in multiple possible different instruction sequences, which have to be "weighted" for the final selection of the "best" sequence. The sequences then can map to different tree structures, which are created from the AST. That means that modifications should be applied to copies of the AST, and it's unpredictable how big the different trees for more complex expressions will become. DoDi