Related articles |
---|
Maximal Munch instruction selection: how to connect tiles? divcesar@gmail.com (=?UTF-8?B?Q8Opc2Fy?=) (2015-09-28) |
Re: Maximal Munch instruction selection: how to connect tiles? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2015-09-29) |
From: | Hans-Peter Diettrich <DrDiettrich1@netscape.net> |
Newsgroups: | comp.compilers |
Date: | Tue, 29 Sep 2015 17:16:27 +0200 |
Organization: | Compilers Central |
References: | 15-09-024 |
Keywords: | code, optimize |
Posted-Date: | 29 Sep 2015 11:53:13 EDT |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.