Alexander Richardson
3a4b351ba1
[IR] Introduce the ptrtoaddr
instruction
...
This introduces a new `ptrtoaddr` instruction which is similar to
`ptrtoint` but has two differences:
1) Unlike `ptrtoint`, `ptrtoaddr` does not capture provenance
2) `ptrtoaddr` only extracts (and then extends/truncates) the low
index-width bits of the pointer
For most architectures, difference 2) does not matter since index (address)
width and pointer representation width are the same, but this does make a
difference for architectures that have pointers that aren't just plain
integer addresses such as AMDGPU fat pointers or CHERI capabilities.
This commit introduces textual and bitcode IR support as well as basic code
generation, but optimization passes do not handle the new instruction yet
so it may result in worse code than using ptrtoint. Follow-up changes will
update capture tracking, etc. for the new instruction.
RFC: https://discourse.llvm.org/t/clarifiying-the-semantics-of-ptrtoint/83987/54
Reviewed By: nikic
Pull Request: https://github.com/llvm/llvm-project/pull/139357
2025-08-08 10:12:39 -07:00
..
2025-02-13 12:13:39 +01:00
2014-08-19 21:08:27 +00:00
2020-08-27 18:43:16 +01:00
2023-06-20 16:43:14 +02:00
2014-02-26 12:06:36 +00:00
2022-12-14 13:38:20 +01:00
2020-07-20 19:54:35 +05:30
2022-01-18 14:08:36 -05:00
2024-10-09 09:27:28 +04:00
2023-09-13 08:38:48 +03:00
2024-08-12 14:56:53 +04:00
2015-10-10 14:18:36 +00:00
2018-09-20 18:59:33 +00:00
2020-08-27 18:43:16 +01:00
2020-08-27 18:52:59 +01:00
2022-03-16 14:11:53 -07:00
2025-03-25 17:14:07 -07:00
2020-07-20 19:54:35 +05:30
2022-12-14 13:38:20 +01:00
2017-07-11 22:23:00 +00:00
2021-05-25 16:30:34 -07:00
2025-01-29 16:56:47 +01:00
2025-07-02 09:29:36 +02:00
2016-03-16 23:17:54 +00:00
2019-08-03 14:28:34 +00:00
2016-03-03 10:08:02 +00:00
2018-09-24 12:47:17 +00:00
2020-10-12 15:43:12 -07:00
2024-07-25 09:19:22 -04:00
2014-08-19 21:08:27 +00:00
2014-08-19 21:08:27 +00:00
2014-02-26 12:06:36 +00:00
2022-07-04 16:41:40 +02:00
2016-01-29 05:55:09 +00:00
2016-01-29 05:55:09 +00:00
2014-08-19 21:08:27 +00:00
2022-12-13 12:24:05 +01:00
2022-05-10 16:03:42 -07:00
2022-05-10 16:03:42 -07:00
2022-05-10 16:03:42 -07:00
2022-04-12 11:38:35 -07:00
2022-12-14 13:38:20 +01:00
2022-07-11 16:46:21 +02:00
2025-04-11 15:32:37 -04:00
2025-04-11 15:32:37 -04:00
2023-06-20 16:43:14 +02:00
2014-03-11 10:48:52 +00:00
2025-01-29 16:56:47 +01:00
2025-01-29 16:56:47 +01:00
2025-01-29 16:56:47 +01:00
2025-01-29 16:56:47 +01:00
2016-09-09 17:24:31 +00:00
2025-01-29 16:56:47 +01:00
2025-01-29 16:56:47 +01:00
2025-01-29 16:56:47 +01:00
2018-07-09 17:57:48 +00:00
2025-07-21 10:39:09 +02:00
2024-02-22 14:07:16 +00:00
2024-11-06 11:53:33 +00:00
2014-09-23 08:48:01 +00:00
2023-03-14 16:48:33 +00:00
2023-03-06 18:34:32 +00:00
2025-05-27 15:51:48 +02:00
2025-05-27 15:51:48 +02:00
2025-02-19 10:13:37 +01:00
2025-02-19 10:13:37 +01:00
2025-05-27 15:51:48 +02:00
2022-09-07 12:47:21 +02:00
2024-11-07 08:11:15 +00:00
2023-07-12 12:31:42 +05:30
2022-12-14 13:38:20 +01:00
2014-09-23 08:48:01 +00:00
2020-05-15 11:33:17 +05:30
2025-04-01 14:27:11 +01:00
2025-04-01 14:27:11 +01:00
2025-04-01 14:27:11 +01:00
2025-04-09 18:00:28 +01:00
2025-07-06 22:30:31 +01:00
2018-08-16 21:29:55 +00:00
2015-08-03 17:26:41 +00:00
2020-04-18 12:49:31 -07:00
2017-09-21 23:14:52 +00:00
2017-09-21 23:14:52 +00:00
2025-04-01 14:27:11 +01:00
2017-04-18 01:21:53 +00:00
2017-09-21 23:14:55 +00:00
2017-06-14 13:14:38 +00:00
2017-08-23 20:31:27 +00:00
2017-08-30 18:06:51 +00:00
2017-08-30 18:06:51 +00:00
2017-02-07 17:35:41 +00:00
2023-06-16 00:49:59 +02:00
2021-09-16 10:41:55 +05:30
2021-09-16 10:41:55 +05:30
2019-01-15 16:18:52 +00:00
2016-10-26 08:34:19 +00:00
2021-05-24 19:43:40 +02:00
2018-09-20 08:53:06 +00:00
2020-05-13 12:52:30 +05:30
2023-06-16 00:49:59 +02:00
2017-04-28 22:25:46 +00:00
2016-11-03 19:42:02 +00:00
2016-04-15 15:57:41 +00:00
2020-09-25 10:08:43 -07:00
2020-09-25 10:08:43 -07:00
2019-03-19 13:49:03 +00:00
2022-12-02 17:12:03 -05:00
2018-05-09 02:40:45 +00:00
2018-01-24 09:56:07 +00:00
2018-05-09 02:40:45 +00:00
2021-05-24 19:43:40 +02:00
2021-10-31 20:00:57 -07:00
2025-03-22 08:09:49 +00:00
2020-10-17 08:42:28 +05:30
2018-04-26 18:17:58 +00:00
2025-03-31 07:42:21 -07:00
2024-10-15 17:11:25 +08:00
2020-05-28 13:46:41 +05:30
2020-05-28 13:46:41 +05:30
2020-05-28 13:46:41 +05:30
2025-01-29 16:56:47 +01:00
2024-08-20 11:25:49 +03:00
2025-07-03 14:28:32 +02:00
2023-06-20 16:43:14 +02:00
2014-12-08 00:41:39 +00:00
2020-10-29 01:34:15 +05:30
2020-10-29 01:34:15 +05:30
2022-12-14 13:38:20 +01:00
2013-12-15 11:50:45 +00:00
2017-05-11 12:28:08 +00:00
2025-01-29 16:56:47 +01:00
2014-09-23 08:48:01 +00:00
2022-12-14 13:38:20 +01:00
2024-09-02 12:42:52 +02:00
2022-12-14 13:38:20 +01:00
2024-08-20 11:25:49 +03:00
2024-08-20 11:25:49 +03:00
2017-09-07 01:33:52 +00:00
2019-07-11 01:14:30 +00:00
2019-07-11 01:14:30 +00:00
2024-11-28 11:21:38 +01:00
2016-12-28 22:30:28 +00:00
2016-12-28 22:30:28 +00:00
2016-12-28 22:30:28 +00:00
2016-12-28 22:30:28 +00:00
2014-12-15 19:07:53 +00:00
2025-02-13 12:13:39 +01:00
2022-12-14 13:38:20 +01:00
2016-03-29 05:25:17 +00:00
2018-02-23 23:13:18 +00:00
2018-02-23 23:13:18 +00:00
2016-03-27 23:17:54 +00:00
2022-12-14 13:38:20 +01:00
2014-12-15 19:07:53 +00:00
2022-12-14 13:38:20 +01:00
2014-09-23 08:48:01 +00:00
2019-04-17 17:38:09 +00:00
2022-12-14 13:38:20 +01:00
2019-02-12 21:55:38 +00:00
2022-12-14 13:38:20 +01:00
2023-07-12 12:31:42 +05:30
2024-10-11 12:09:10 +07:00
2015-06-16 20:03:39 +00:00
2015-07-02 16:22:40 +00:00
2022-11-04 10:21:38 +01:00
2025-08-08 10:12:39 -07:00
2020-10-10 17:51:12 +05:30
2016-02-10 21:55:02 +00:00
2023-07-12 14:35:55 +02:00
2014-08-19 21:08:27 +00:00
2022-12-14 13:38:20 +01:00
2014-09-23 08:48:01 +00:00
2025-02-24 10:11:53 -08:00
2024-11-18 15:16:48 -08:00
2015-10-27 21:17:06 +00:00
2022-12-14 13:38:20 +01:00
2014-09-23 08:48:01 +00:00
2024-08-27 13:53:25 -04:00
2023-12-06 08:41:44 -08:00
2021-02-12 22:58:26 -08:00
2024-08-27 13:53:25 -04:00
2024-08-27 13:53:25 -04:00
2024-08-27 13:53:25 -04:00
2024-08-27 13:53:25 -04:00
2024-04-10 19:46:01 -07:00
2024-08-27 13:53:25 -04:00
2024-08-27 13:53:25 -04:00
2023-12-06 08:41:44 -08:00
2024-08-27 13:53:25 -04:00
2024-08-27 13:53:25 -04:00
2024-04-10 19:46:01 -07:00
2024-03-27 11:41:34 +00:00
2024-04-10 19:46:01 -07:00
2025-04-14 20:34:02 +02:00
2016-08-12 13:53:02 +00:00
2023-12-06 08:41:44 -08:00
2024-04-10 19:46:01 -07:00
2024-04-10 19:46:01 -07:00
2025-04-07 21:59:11 +07:00
2022-12-14 13:38:20 +01:00
2024-10-18 15:58:33 +01:00
2022-12-14 13:38:20 +01:00
2022-05-20 15:27:29 -07:00
2019-10-24 13:08:50 -07:00
2022-12-14 13:38:20 +01:00
2019-08-13 01:23:06 +00:00
2024-02-23 10:24:15 +01:00
2019-08-08 16:59:31 +00:00
2024-01-16 17:01:01 -08:00
2024-01-16 17:01:01 -08:00
2023-10-11 10:23:38 +01:00
2025-04-01 14:27:11 +01:00
2023-03-02 09:29:42 +00:00
2018-02-12 19:45:54 +00:00
2018-02-12 19:45:54 +00:00
2024-06-14 15:07:27 +01:00
2017-07-28 20:21:02 +00:00
2017-02-01 22:45:09 +00:00
2022-11-04 10:21:38 +01:00
2020-03-11 13:26:06 -07:00
2020-03-11 13:26:06 -07:00
2022-12-14 13:38:20 +01:00
2014-05-17 21:00:22 +00:00
2022-12-14 13:38:20 +01:00
2019-05-15 02:35:32 +00:00
2024-04-11 12:29:29 -07:00
2017-07-19 00:09:54 +00:00
2017-07-19 00:09:54 +00:00
2020-07-23 13:07:28 -07:00
2017-06-12 20:10:48 +00:00
2015-02-27 21:17:42 +00:00
2022-12-19 11:23:17 +01:00
2025-01-29 16:56:47 +01:00
2024-03-06 09:51:48 -05:00
2019-08-13 01:23:06 +00:00
2019-04-10 06:20:20 +00:00
2022-08-18 16:28:55 -07:00
2019-07-03 17:31:43 +00:00
2021-06-17 09:38:28 +02:00
2021-06-17 09:38:28 +02:00
2022-12-14 13:38:20 +01:00
2021-02-22 15:42:16 -08:00
2017-10-06 18:06:59 +00:00
2024-08-28 12:48:20 +01:00
2018-05-09 02:40:45 +00:00
2015-11-05 22:03:56 +00:00
2022-12-14 13:38:20 +01:00
2022-12-14 13:38:20 +01:00
2021-02-22 15:42:16 -08:00
2020-10-07 10:36:44 -07:00
2022-06-27 10:48:45 +00:00
2022-06-27 10:48:45 +00:00
2024-04-29 10:16:45 +01:00
2024-04-29 10:16:45 +01:00
2024-04-29 10:16:45 +01:00
2021-05-11 08:23:55 -07:00
2024-05-28 16:09:53 +02:00
2024-05-28 16:09:53 +02:00
2024-03-27 11:41:34 +00:00
2018-09-12 08:54:06 +00:00
2014-08-19 21:08:27 +00:00
2014-02-26 12:06:36 +00:00
2014-08-19 21:08:27 +00:00
2024-06-04 08:31:03 +02:00
2024-11-21 11:21:12 +00:00
2015-09-17 20:12:00 +00:00
2022-12-14 13:38:20 +01:00
2014-06-13 14:24:07 +00:00
2015-01-20 05:58:07 +00:00
2015-01-20 05:58:07 +00:00