From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id gCTSOMi9E2fTMgAAqHPOHw:P1 (envelope-from ) for ; Sat, 19 Oct 2024 16:10:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id gCTSOMi9E2fTMgAAqHPOHw (envelope-from ) for ; Sat, 19 Oct 2024 16:10:17 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="bR/3oAo9"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=lTs+MrWV; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1"); spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729347016; a=rsa-sha256; cv=pass; b=n0H7jjBzsfFwvXd1RLdToq3mxUInypD9ozncxPKcxPBXbcafasSE/F6bsm7sNKj70ZjHT9 tlm5gkuKJUzanJ2X21SL8V7UEW/0dCfOsfC5UWLYMKAUIibNyUp0UA62rYik69pTd/KPbh zHGDFX6/mtFUzqJte1dweqEk4n4wm9FkVb33YyYPacGCTbR4BbkRQ+sWiaVxHr65ppK3wB jWKjkW8ZjZciZZZ9IchZ+KFLXpPL32KunIS/wWtneep6f3sATL7rDxrNCMCYWqcbIvWxzq 8p2fSujYnzt1iMYUXqbnpE1QI+u5lRnh0FwK9XeJ7ShswfX6VoAq2FA0CLM/1Q== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="bR/3oAo9"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=lTs+MrWV; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1"); spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1729347016; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=doMeSaOA6Ct3EQMzf6DJapHm6WYkos4tBr28YrCgEJ8=; b=k1Bs4fdLRdEdp7GHKQiwNCgQZSatP2WZ6A66uuK/53ZW24gThj1gzJMnk5RHlVitHPnYKD hGhRHD/5UUgETSIiBqHMs+/+Zx0YEYMt1/dtMtSYxmdNzrPAsnBlyv/QNoIAea5dniZPXR 0Te2RO+ZwqrJMAztKtSy7QER9GZV4gD1eGRZ1EyPnulTjP/pNQegaTA3YEynuBD9SRPEHJ TA1qB34Dp/P65KWCw91sN3uo4QqV2y7QHQ4B2rXA9x5qrVOlKM6RKE/4s35LUOevj9ywr/ shEWbck2hywx1fz2BqQycyOD8BZCxrLKRLmxcNUEJOO0nNE849dnG3j2Dy4+Ew== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 729E376E68 for ; Sat, 19 Oct 2024 16:10:13 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=NVbbJ2U23/1KVa7iY5NkYAKdyEV0ZNyL8GCdVVp7WkY=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1729347012; v=1; b=bR/3oAo93Or8IRJs7ob/WDRfcb9ygB0MdQ5AQwoy/GEuylT1VlfrBJZ51RHmiS2nxXjOsiLN BS/vRQovVMZB8h6w8zLbOyY57mcRLZ5m3pvEaaO/LhRjCd6HwGLlPI1YXSJCffqFr7TjJMbmRCw JIKb0ppl7nGn1I5+5O8wQjCif3YF7KTJYWqRWO5fYZEw/TzrbmncTYcehSFrSMxachBzYAKoO+P 1DO7Morwwesxys5T06Gk73IqmDOYlEGzkNEbrBPgoUEtEt9/lZQ9goIEoR/2YozZA1eJqi4wtWk 1+EIJbD8+ceV33Z6QLzXoKlF3Cd0E0kDPPk23MWgJJ+xw== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 7387F20260 for ; Sat, 19 Oct 2024 14:10:12 +0000 (UTC) Received: from poodle.tulip.relay.mailchannels.net (poodle.tulip.relay.mailchannels.net [23.83.218.249]) by mail-a.sr.ht (Postfix) with ESMTPS id E887A20259 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sat, 19 Oct 2024 14:10:10 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 5F5D68A53AE for <~johnnyrichard/olang-devel@lists.sr.ht>; Sat, 19 Oct 2024 14:10:08 +0000 (UTC) Received: from uk-fast-smtpout10.hostinger.io (100-103-24-231.trex-nlb.outbound.svc.cluster.local [100.103.24.231]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id B1EBE8A5032 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sat, 19 Oct 2024 14:10:07 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729347008; a=rsa-sha256; cv=none; b=KcxjOzpXyD26q0kQPXO/mjbydYfuaMCBsEf+oug9Ei6tp0J6IcXNz1FrdUdM3K5vjsapxA k4qh3MjtH7w15yl7o1lRjA1MfDuRp02RGSbInJu1eQoE8/RWCxOrBNEAvu/Hy8rU59erUT 9LEdvcEkjGt7Od7YHhNUytSNwKswYurYJJ3/akFJGhG/qnYeCJdPud4S9+0ShFKhBHN1jH 5Ay/ys/i5jhyseKRrEYPPMTo3GS+Tqz+cr2nLwGa8fllmI6b1MCHAawW9H3yDXMKy+NLvc zdiMYntiMhDjF5ZSAwiVLUvW/yyO1gftFcaf3Svx6SzRuLdfMOxl1b1/VqR99w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729347008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=doMeSaOA6Ct3EQMzf6DJapHm6WYkos4tBr28YrCgEJ8=; b=Nb5ARox4Iz9wydhdz7L2AgCpqW9Y4BJ/MIkqZluMngXs/BKEtDny3o55wrSOZX1owSYCTU lGF+icVsvDFLFNY7OF5gaDdQOI3yA9a/Exo304VjKFUpc27DaybDQa1f/PZDAmkj1D6fnS uaQKs5y1x8n8itmckb8T33VzNNYJ9i19V195m9f5j4JjPxFik2E+BjkB4fnjtbehUJzXzJ GF0AjtFzeJj+fkzVd+FzB/T79rJbBV/KN2op6HJ2Jzt+wQsDo+XFPPO3GK4XtFp7gNHBOO 0hqgPhkl1qrd5UbFVugGN5fNWckgrwCXFhh/5q1+3P3ou7duidzu3jdHXXy/aQ== ARC-Authentication-Results: i=1; rspamd-6bcbdd57f8-xqjhk; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Shade-Macabre: 17bee7a054879295_1729347008247_2973801779 X-MC-Loop-Signature: 1729347008246:310653868 X-MC-Ingress-Time: 1729347008246 Received: from uk-fast-smtpout10.hostinger.io (uk-fast-smtpout10.hostinger.io [145.14.155.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.24.231 (trex/7.0.2); Sat, 19 Oct 2024 14:10:08 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729347005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=doMeSaOA6Ct3EQMzf6DJapHm6WYkos4tBr28YrCgEJ8=; b=lTs+MrWV+6FPa13jhuZbFrHHFnPXsfasW6UNpLaLnJYJcBY4Wo9EgvWL/sv5T9YD2z5yc8 PbkpnP0LDYn7uh93I622UbIme1YGSOGT0xo+vxAVX+xe5vn3TsCVPOQGbuOx6jVn2eS2Ve 7aoW4dM170Alaed0M3Qfe56Onj+z3QyyldMzL62tpVKnOI80BNlXKZ+ah8RMR0fVs7gvnx lkUUCrVepZz3TaHcWdmXNOwg6FJucjTcBqRhvxA51WKfCzFzgnZfV4AKM/Cgwk7qj3KM7A JArXylkmwS3tGqqm3AmhyiMSPUI+pSAMmx0P2dOZkm9f7hrkUc/gCaxhSh2i/g== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 0/1] deref operation returning value Message-ID: <20241019141000.185147-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Sat, 19 Oct 2024 14:10:05 +0000 (UTC) X-CM-Envelope: MS4xfAoDoX6x6v7xP9T/QjcCB24Gs+gjc112KJkEq/qjGg4JWOoAvjHcDIWAARGSM871818GkHdv9oRvZ3oI4xAOvKIZQsmMSHkTsHSiXNzJVBU3WHpcKxzO 9Z7WwHB8bwl/vlyr0VgpwBksROmmLR1COY2U0qFuHNB5YF6DF0d/TuNOGtbVtwweBadhEQHQQoNuxN3z53hCK7NfdvyX2e0y+M4BHQpiwMMxnHpXcpsUE1TM X-CM-Analysis: v=2.4 cv=TcnEtgQh c=1 sm=1 tr=0 ts=6713bdbd a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=nPOCGltEwKIYVpINTzoA:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Country: NL X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.61 X-Spam-Score: -5.61 X-Migadu-Queue-Id: 729E376E68 X-Migadu-Scanner: mx10.migadu.com X-TUID: u6BnBeVAGnZV We had discussed over IRC about may adding some extra information on the deref operation to support this feature, but there are two reasons why I opted to keep this on code gen: 1) Modifying the AST would require changing the unary data structure from a struct to an union, but no other operator would be beneficed by this since only the deref needs some extra information. 2) The assign operation is required to identify if its LHS is a deref, once the mov instruction will differ from a simple ref: The simple ref will mov the expression result to a RBP offset and the deref will mov the expression result to the pointer location. Also, once we have the IR, this logic could easily fit the layer that will build the IR. V2: - Fix code style - Allows multiple pointer dereference Carlos Maniero (1): codegen: x64: deref returns pointer value src/codegen_x86_64.c | 88 +++++++++++++++++++++++++--- src/parser.c | 11 ++-- tests/olc/0038_pointers_deref.ol | 24 ++++++++ tests/olc/0039_pointer_of_pointer.ol | 55 +++++++++++++++++ 4 files changed, 164 insertions(+), 14 deletions(-) create mode 100644 tests/olc/0038_pointers_deref.ol create mode 100644 tests/olc/0039_pointer_of_pointer.ol base-commit: 2dbf9a9896e5778535bd3dc1d5069a762d3b94fa -- 2.46.1