From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 709F23858000 for ; Tue, 15 Aug 2023 12:07:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 709F23858000 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b9b904bb04so85090531fa.1 for ; Tue, 15 Aug 2023 05:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692101250; x=1692706050; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6ggJ6Vj0wLIeFVP8AI2Rtfgpxmu5RJvqKjqeI0dBBwI=; b=r59CMa3sDbBBziY+NjkZFqyZI6O+rbfLpdaWOZ4bqAuEV0pePopeh5CuRZpNFhTF2d VoM3x9yzIXhCKhrs69OycX7dvBjJCi9c9r1KDAzy8MLu/lSbWZLrMJ7Kom+2bCMzlOUU TkrZsC/VTn/rpP1xmIyeD/ekh4XLULOqIjHZSJIpK7VzTYgdZGET38QdOmVfnmeAW+9s 1/75UgZJ0MHYE9dV43JpZpQOXvDAs4YAOk71pZG/W1Kk64S6wGx2JgqnkZUXzyxeqA17 pF9iFFJtFWi/QoVr1wvoU2toDPdAyVyN0MCJpLEye5Mg7qk7oiXjI76wnFNv8Fiv1kQn YcnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692101250; x=1692706050; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ggJ6Vj0wLIeFVP8AI2Rtfgpxmu5RJvqKjqeI0dBBwI=; b=KO6GCLkFQCTW5axr89zvnx/1C+6OHhBLHCiv36vAQ0EFZ+3d/Wquk5FJGe5GEqNweh qzuU26yutoP8Ti5fJJBv2yGeyLktA7Pqayu+M7yfPP4D260vhMV4Y9iAdh/ZVhH/WNpu 24lnz0Uk1nAYmvX+BP69kHgcXG3xMNs+yt8BPFrjjX2lXWPeSdrhYfeDjsWIj7TkPeGU CnY1wTOdi8gtsd3BxuNs2SysLqXW30ptrM0E14aCblHGMZ9bfy1D437pCXvHM21LbvXI HrHvfJI2QcUQvV4P6ts3GwWbt8i3mUW+4DaSflsol0gAvZ18U7mZOAAQPHwdYxYgV0VM B87Q== X-Gm-Message-State: AOJu0Yzt4H078gz4l0aRPHe90WRn7oLNLLqhLbah380hwfi2J8HkB08o 9UF0BJNpSXrf4Xy6PCRrtlZLBUrVYINgUbjX57k= X-Google-Smtp-Source: AGHT+IFh5hYwqUcmrdpna1Pl208RWqz4BvyYWvQd9DxqwWT6ckGCWDlgqKUj06krPo0XL9WWgMRgXwhfdXThkDT2l00= X-Received: by 2002:a2e:9f44:0:b0:2b6:ce35:2e9e with SMTP id v4-20020a2e9f44000000b002b6ce352e9emr8716651ljk.44.1692101249626; Tue, 15 Aug 2023 05:07:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 15 Aug 2023 14:06:11 +0200 Message-ID: Subject: Re: Porting to a custom ISA To: MegaIng Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Aug 15, 2023 at 1:38=E2=80=AFPM MegaIng via Gcc w= rote: > > Hello everyone, > > I am currently in the process of porting gcc to an ISA I designed with a > few others (spec [1]). Using the old ggx/moxie tutorial as a guideline > and looking at the source of other backends, as well as the quite decent > gccint document, I managed to get basic programs running (binutils, > especially gas, was also not too hard to get running). I am now > partially writing here because the gccint documents tells me to do this > (I am unsure if our project will ever be mature enough to be added to > gcc, but I don't think it hurts to strive for that), and partially > because I do need a bit of help with some stuff that I can't find > documentation for. > > One of the big challenges I am facing is that for our backend we > sometimes support 16bit as the max size a CPU supports, including for > pointers, and sometimes 32bit or 64bit. Am I seeing it correctly that > POINTER_SIZE has to be a compile time constant and can therefore not > easily be changed by the backend during compilation based on command > line arguments? POINTER_SIZE needs to be only a C expression, not a constant > Also, on another backend I saw comments relating to libgcc (or newlib?) > not working that well on systems where int is 16bit. Is that still true, > and what is the best workaround? You could look into the AVR port for example. I think libgcc should work reasonably well here. > And a bit more concrete with something I am having a hard time > debugging. I am getting errors `invalid_void`, seemingly triggered by an > absent of `gen_return` when compiling with anything higher than -O0. How > do I correctly provide an implementation for that? Or disable it's > usage? Our epilogue is non-trivial, and it doesn't look like the other > backends use something like `(define_insn "return" ...)`. Somebody else has to answer this. Richard. > Many thanks in advance, > > MegaIng > > > [1]: https://github.com/ETC-A/etca-spec >