Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1619

Maximal Munch instruction selection: how to connect tiles?

Path csiph.com!xmission!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.misty.com!news.iecc.com!.POSTED!nerds-end
From César <divcesar@gmail.com>
Newsgroups comp.compilers
Subject Maximal Munch instruction selection: how to connect tiles?
Date Mon, 28 Sep 2015 15:56:17 -0300
Organization Compilers Central
Lines 49
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <15-09-024@comp.compilers> (permalink)
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace miucha.iecc.com 1443468983 88429 2001:470:1f07:1126:0:676f:7373:6970 (28 Sep 2015 19:36:23 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Mon, 28 Sep 2015 19:36:23 +0000 (UTC)
Keywords optimize, question
Posted-Date 28 Sep 2015 15:36:23 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:1619

Show key headers only | View raw


Given the expression a = b + c; my compiler currently produces the
following IR-tree:

    =
  /     \
a       + (_t1)
       /    \
     b      c

that is, it assumes:
- an assignment operator that copy from a register (_t1) to a memory (a);
- an add operator that sum the content of two memory regions (b and c)
and put the result in a register (_t1).

I am trying to use the maximal munch strategy to produce assembly code
for this tree but I'm stuck with the following questions:

1) The '=' operator assume the right hand side expression to be in a
register; what happens if that turn out to be impossible? I.e., what
happens if there is no '+' instruction that put the result in a
register.

2) Consider that there is no '+' instruction that can sum two memory
regions but there is one that can sum two registers. How can I make
use of the later instruction? I imagine that I should use loads to
move the variables to registers and later connect the '+' instruction
to these registers. But in that case, should the tree be modified to
reflect that change?

3) Is there any text with a complete and formal description of the
Maximal Munch IS algorithm?
[Appel's Modern Compiler Implementation in <x> has a description and sample
code, but it doesn't look like it'd be very helpful here.  I'd suggest adding
more nodes to your tree to make it easier for instruction patterns to match,
e.g., start with a tree that pretends every value will be loaded into a
register, and if your ISA has memory to register ops, the instruction patterns
match some of the loads and you can then forget about the registers that
the matched loads didn't use:

     =
  /     \
a       + (_t1)
       /    \
      _t2   _t3
       |     |
       b     c

-John]

Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Maximal Munch instruction selection: how to connect tiles? César <divcesar@gmail.com> - 2015-09-28 15:56 -0300
  Re: Maximal Munch instruction selection: how to connect tiles? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2015-09-29 17:16 +0200

csiph-web