delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/04/28/16:00:07

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=WAjcUOHe2OehmVHu
JAWrJ/yqZz8Mtq7GyeB1g5Uv95EuZaAa2Puaoy+m1oVRlK/Dxtm64GN8I4qANEQz
dOEYkNmoB7XsuU4uQYtQfCAtdqG2DLEwPcYFoc9E5eBIPYIMZlYevuwceVYkJeQQ
kwq7nZoNW96wASDYTTYGx2KMCOA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=uVHhfz/x/3RVoMWw2S222Q
0fsoU=; b=Y50DDpp6jOkD/EHMFgeofYFhTjVXdTuFpFf6idb6jfnlsSx2SnrhMa
Sn1tQkYX4c27o3Xl0U9pQeLcxHgNIl4anyXfg8HrytTR2LRqOg6/FkMzyW2EwI4F
GTDfemjki9os59HITfBnJMlnOOsqlGflTWZ83j3SKDaRHWSeVEEDM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=designers, eliot, Eliot, differences
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: Request for an example x68 assembler portable Hello World script
To: cygwin AT cygwin DOT com
References: <CA+wh7Kg4UAO+_ZBONXbJ=3Hf9Tz6LSX2DX+LQNPLYqty4wkTag AT mail DOT gmail DOT com> <CA+wh7Kg+KDGN0b=-UFZ7UnX_fgHw69p_PXmdaqSrncHZsVGCbA AT mail DOT gmail DOT com>
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu>
Date: Sun, 28 Apr 2019 16:00:03 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <CA+wh7Kg+KDGN0b=-UFZ7UnX_fgHw69p_PXmdaqSrncHZsVGCbA@mail.gmail.com>
X-IsSubscribed: yes

On 4/26/2019 5:04 PM, Jesse Thompson wrote:

> Ultimately what I am trying to research is how to begin building a simple
> compilation system of my own, so how do the *makers* of compilers deal with
> these differences in calling convention?

They make parts of the compilers conditional on the overall platform.
For example, if a compiler is written in C / C++, they use #define
and #if tests, and may include different modules in a build, etc.

They also try to code various algorithms, such a register allocation,
to be parameterized by a description of how things work on a given
platform.

There are whole swaths that are essentially target independent,
especially those having to do with higher level optimizations.
However, even there, platform differences may lead to different
parameter settings (e.g., default number of times to unroll a
loop) or strategies (presence / absence of vector units and
of predicated instructions (as on the ARM) affect how you want
to generate even the high-level target-independent code).

In the case that you are talking about, most of the code generation
and optimization strategies are the same -- there are just some
fine points different about calling sequences, register usage
conventions, etc.  I think those are mostly addressed by the kind
of parameterization-by-descriptions (or by #defines) that I have
described.

You may still see somewhat different code from different compilers,
even for the same platform, simply because the different designers
chose different base code sequences - which may be equivalent. For
example, to move a constant into a register, add-immediate (adding
to zero) and or-immediate (again, ORing with zero) give the same
result for many arguments, to the choice is arbitrary.  One can
come up with many such examples.

Supporting multiple target instruction sets, or even the range of
models of the x86 line, requires some amount of platform-specific
work, of course, and lot of attention to how to build components
that are either independent of the ISA or retargetable in some way.

Regards - Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019