From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 64E423858D28 for ; Mon, 3 Jul 2023 00:50:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 64E423858D28 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-pf1-x430.google.com with SMTP id d2e1a72fcca58-666ed230c81so3351751b3a.0 for ; Sun, 02 Jul 2023 17:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688345448; x=1690937448; 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=gXXsNVESHvQu+g1+zjwm/DihbcMKTUn62xHBd/E9tg0=; b=VSHWm8Vb2sVxsAxJ/W2VkP4kTzY2yED9ekQ4tnbuN4w1aORdkU8dtcGDOEwb/OKFV4 f01ie3iSqI8cmIFhxaKO1bO1RxwhcP91lkZJJ1LTgA/zzBEz3brC3hngBOZCTJkFqpwl oOVfZt/ibx0CgUuM1zGZEY/PldQFblK5pznZ84aEuN2r/UqvHhtkgN84PBszhDUIhvxQ TQOfIAYpIndKI0gfdGFTAiM/FofkmPunKUaxDOci2adDML1rGOytC4MAAWY5jqZll2WY KJtLp/SK/58nMIF3bnfI1FCgP/7VUXC2SHstYGrnuv44DW4iHL9Ip7Sbg17SwKWzM0f3 EJ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688345448; x=1690937448; 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=gXXsNVESHvQu+g1+zjwm/DihbcMKTUn62xHBd/E9tg0=; b=dfiKUZqur04VKfMbbwYMuvGNENbBUNUqFctACQZAmto0p4oJkSPXyrA5HBeyR6mtg0 huQsDRHNJ5EnBigOvJnPXZbxHO41+Pvmey/PWsN7Mh4our9Ya/yeEpPH10H2XSB7QH8x zyq4Vl9M1KQrYCcZLR+T2jL8cczQ6ZplRSm+qWzDKnGUvkWeJeH+U0ovNF56w20sZDq2 09HLnBp3/XCxWV6rDRDMYBPUF0+wK5h0PED+x4orEMzAPHVDYZwAmRlWb9ZZfeH5NksH CoA5px4CumpHbqVBEuW7kgokiqeT/0NWTk+CE5X8WuxI+aP5qqDZB0DBCXtShr45IxkG 0j9g== X-Gm-Message-State: ABy/qLYp8ZTdsjSY5G71mV0SsceMV/YPt40QSmqPIZPg0FTHIGT6f+io FKY/QAPqqWfhm750wUwgZ4FgGvI1zCbzgmI+sEM= X-Google-Smtp-Source: APBJJlGy7AjkGVhKUsBadCt3Frt+fF504KeVGj0jgjUWLIL1BS9ZiuIFQ9Ube/KqDxnVvYkM5QiAskMwA6+mSYHDzJM= X-Received: by 2002:a05:6a00:24c9:b0:682:537f:2cb8 with SMTP id d9-20020a056a0024c900b00682537f2cb8mr12380813pfv.26.1688345448213; Sun, 02 Jul 2023 17:50:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Pinski Date: Sun, 2 Jul 2023 17:50:36 -0700 Message-ID: Subject: Re: Mapping of TREE_CODE to tree_node To: Aaron Lorey Cc: David Malcolm , gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.4 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,T_SCC_BODY_TEXT_LINE 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 Sun, Jul 2, 2023 at 5:48=E2=80=AFPM Aaron Lorey via Gcc wrote: > > Am Mo., 26. Juni 2023 um 20:09 Uhr schrieb David Malcolm : > > > > On Mon, 2023-06-26 at 18:59 +0200, Aaron Lorey via Gcc wrote: > > > Hello, > > > > > > this is the first time I am writing to a mailing list. I've tried > > > researching the normal procedure but nothing special seems to be > > > required. > > > > > > I'm currently trying to do a complete graph-discovery of GCC's symtab > > > / > > > tree_nodes to dump the full internal representation of the > > > compilation > > > unit. Gitlab: https://gitlab.com/graph-prog/code-database > > > > > > It is not exceptionally heavy but also not very easy to serialize the > > > internal state to disk. I think this task was simply not considered > > > in the > > > design. > > > > > > Reason for writing to the mailing list are the troubles in connecting > > > the > > > TREE_CODE enumeration to the appropriate struct tree_node memory > > > layout > > > without guessing. > > > > > > Can you provide a mapping of TREE_CODE to tree_node memory layout? > > > > I don't know that such a mapping exists directly, but have a look at > > the functions "tree_code_size" and "tree_size" defined in gcc/tree.cc. > > > > You might also find the LTO streaming code of interest; see gcc/lto- > > streamer-{in,out}.cc > > > > Hope this is helpful > > Dave > > > > > > Thank you for your reply. > > The tree_size() and tree_code_size() functions are useful, although incom= plete. > > If I understand correctly, the link time optimization works on the > GIMPLE representation. The original syntax tree and symbol table would > be preferable. You could also look into the module support in the C++ front-end, `gcc/cp/module.cc ` which does store out the original trees and such. Thanks, Andrew > > Andrew's suggestion might be more what I'm looking for.