From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77009 invoked by alias); 28 Apr 2019 20:00:30 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 76897 invoked by uid 89); 28 Apr 2019 20:00:21 -0000 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 Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 28 Apr 2019 20:00:11 +0000 Received: from [192.168.0.12] (c-24-62-203-86.hsd1.ma.comcast.net [24.62.203.86]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id F21B640121DA; Sun, 28 Apr 2019 16:00:03 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: Request for an example x68 assembler portable Hello World script To: cygwin@cygwin.com References: From: Eliot Moss Message-ID: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu> Date: Sun, 28 Apr 2019 20:00:00 -0000 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00211.txt.bz2 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