From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aCY+Lhx7EGfuzAAAqHPOHw:P1 (envelope-from ) for ; Thu, 17 Oct 2024 04:49:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id aCY+Lhx7EGfuzAAAqHPOHw (envelope-from ) for ; Thu, 17 Oct 2024 04:49:00 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=hSz85yV1; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=jVbeOjLR; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1729133340; 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=8aDQXGX2q7LJjm1O13iUko/3eK5Qqk+/a9xQ+Lwqx/c=; b=SxxA7kFtcrPqZfxOkYGi1/G3/UxnwR8uTEpJQ6HjuEwQ71HYfnN7YgENo852dOcE60J0fc SEsUuFV1u6wJaxuc+oIaHP67zjFojRe7Y0QPkrmq5ZFU7jwpO2wjgqUOcQ8swq5gsEXklt t4rQ/NFvg8DSym2pNccP4vj0wJJMGrE1ksjjUoSxmOu5yNwCfjGILvQoOtT+DE8PdpKZTv y0s33RX9SDOjagKUdLEC208JoIf4+8Q1VPzDFPZ3tK3kgZZOoMOIgXjcmD+tQl4maXh50P xlslFfi+qzeuQ/rIG+wUH47GgDCB7ixL2snYHIPkXnO3hKrGteiM4EokzIw1vg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=hSz85yV1; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=jVbeOjLR; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729133340; a=rsa-sha256; cv=pass; b=NvkXrFrteaDHy7amRKSmhJlM0ejYJhW6R5FXMBNFCP4jOOARBgh6XAJXiTYQdJ9wZ8yhyJ PQGI+FDn7ljKSZYkRkHv36FyD7u7uBTEuL+IdwVool5+i9yDPUkJMP8lLLuUqE6ce0EBy4 DCMnMYXxmpWi1+Vc0pgK7YZFNxqcdEimLco9wj3Lakltuu5DumD7o/Xpr+SEV74vMSeVaU BcYgLSwMIfp+RiOOaxWMpmqPOtdRCDeKfCPElQNaDyxgLeKv1DBTwTIKEQCi8amF+RWVtU mdJTC+sp0NuhzBzG9vkITV50BG/+ev6Jen7PmuRjxBNJto66KcTUVEByLsGNNQ== 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 428E58B15F for ; Thu, 17 Oct 2024 04:49:00 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=eRnor2DSnHXfV5eJQgLUZ0dLUl4+KOuDAzEhqt6/rzI=; 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=1729133340; v=1; b=hSz85yV1pC3rHNz0EerHbUkqyHBO4lA5NX6/BZYuhi8w+4m9cmxeRwR7OwbSqCgeIn3QTVfC 6gZ6gZKXZuW+hTGTZ8KjxcXhVinMBwfw9uQR63/Mq61ghtXXDIX/B/6DLzU1BRcA00UeDH/7W1O g9VwEgNxCSwn88JVaGNTy7diUiQsoVj9LOsra65+gIc70IDxkxfmZxC54TF3kLi2GQP+4FZRHTX wuLcgXJUKBIwFWHOEB8MTqOsAoeft/V2fhV3ksRlTNNnOOqVcvGhTHuL0MjglHEHgF6GsmcickP tv7OcpiwEvFsJPsQQXxoHaYzCUwc592HiJ5lPok6nFN1g== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 08489202E8 for ; Thu, 17 Oct 2024 02:49:00 +0000 (UTC) Received: from chocolate.ash.relay.mailchannels.net (chocolate.ash.relay.mailchannels.net [23.83.222.35]) by mail-a.sr.ht (Postfix) with ESMTPS id EA49D2028E for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 02:48:58 +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 B85874E5980 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 02:48:56 +0000 (UTC) Received: from nl-srv-smtpout1.hostinger.io (trex-12.trex.outbound.svc.cluster.local [100.101.192.204]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 254BE4E5BA5 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 02:48:56 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729133336; a=rsa-sha256; cv=none; b=8Gz3XbHHqx1rS28e8UrwbZucYL21OVObLw3zcrm4gIjhsPmsi6oWqL55W3L/dUgayB6Zyj yKMJgHhmSQM9luflB38WYgZTC5snKC1Y564mcaNIwII4ahCxKUmdXCLVAQiZlCtofaQmwA 4ZngrWIl7T1DELnHI+eWSHk1PVAXApHQdjCi+ycxXjdv+2EAMWjlttAa9CkElYkUFqdEvP 3f3MguO2PlG8zg3Z0seNHViixKJZca/RKUmn8WUEX4qk+M9T7iDs/u19V3Q2KyPEf2Ea9p csL/EcDHzFwoivKOj3UKnmFjVGnnE0wdMtRl/lQD2kDNVEOPPzzlnZABenxmww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729133336; 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=8aDQXGX2q7LJjm1O13iUko/3eK5Qqk+/a9xQ+Lwqx/c=; b=I5xXWq/6uzi1mFCzBDoTHCl36wHJz8RMC/Z/0NiZn6VJQWw8bFL8SMLQgWW2uKngG0QNXR VoRV7gJHt4utWPnSocdKwQuaPbqyrqV96uvohmt50vHHGDHRzsZKXMp6KwcpJ8cgMXsl6F jTIw2Qhbr6lDHFpndvbDFKjzFaL34IYwCyDa4kkrRfvGQj+uploOpvV7wtigpAYpflpiuh mYKudrNuv2/IWfycnaMYIseea1Atd1kOv0sug5hbCbPHwacePlfODFccSJ/EAmd67DwlNT b9j3QnzHZXWpKrqs8OYto7y1h8GsJhUgRgHdfPkr+ztLBDQslJzrexzXGn9KBA== ARC-Authentication-Results: i=1; rspamd-6bcbdd57f8-wdzsb; 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-Broad-Cure: 2c1316c45d4c0f81_1729133336605_1342953706 X-MC-Loop-Signature: 1729133336605:1548032378 X-MC-Ingress-Time: 1729133336604 Received: from nl-srv-smtpout1.hostinger.io (nl-srv-smtpout1.hostinger.io [145.14.150.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.192.204 (trex/7.0.2); Thu, 17 Oct 2024 02:48:56 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729133334; 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=8aDQXGX2q7LJjm1O13iUko/3eK5Qqk+/a9xQ+Lwqx/c=; b=jVbeOjLReQoRnu0lMEie+mjpkK91OPhILZcTUO3YAr5MwC4EwmSFxts4yOdjL5CwIIo2ZY FEPYN7+it8srIgZ7u4ttRQ+2QaxIamnlrMAXTm9FPQL38SU809YPf5F+D6BPysbdzskSVA c1T8KL8fNR7FeWZZIf2XDiyURuT+5v+twFMS0C3C093TcLbQQ4bdSRaOFT/j7oxCB78x9H q/aosXVo61ORIbKkaFlIsqUj9dsVpCP7TN6jq4G5sIFSZh4mcsgcjGrQTAHw2dDiyAP6tr m0KmV+/x8XVknnM9cBStp1Y3pdaqEXSlcMTLn2eggXdAAV+rJadN4RifNPwLbg== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 0/1] deref operation returning value Message-ID: <20241017024849.320062-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 17 Oct 2024 02:48:53 +0000 (UTC) X-CM-Analysis: v=2.4 cv=bZY5U/PB c=1 sm=1 tr=0 ts=67107b16 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=MqB8Zph-UFCGwLVdYMsA:9 a=BXDaF_L80NY05PYiAFlV:22 X-CM-Envelope: MS4xfPu0jKBgExHLHByDIkm89zJ7RP5+AcJi+5mWC7P3cQVq7mWyF7SNvLJj3rPPM2v+StilFKR3CjfJ/6eIO1/FQLQEex8ouwB8vy6PjsgHtEI1q/zB7rYH EEm51HT512BUo7pDH5HMO6v//JGq31IhTMI+QaKmZIOuk0sJKEbZX15MIrMIiEVTEyQZV/tOxCQ0GYFKmuBt04Urq9l2FQeOwrdo8J2sPoCtfk90vQ1Ol06v 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-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -1.56 X-Spam-Score: -1.56 X-Migadu-Queue-Id: 428E58B15F X-TUID: DeC+owtlr0dG 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. Carlos Maniero (1): codegen: x64: deref returns pointer value src/codegen_x86_64.c | 61 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 9 deletions(-) -- 2.46.1