From 74e981e85509ca072b2a45d529dab3a9883613a2 Mon Sep 17 00:00:00 2001 From: Yudi Zheng Date: Fri, 9 May 2025 08:39:16 +0000 Subject: [PATCH] 8353735: [JVMCI] Allow specifying storage kind of the callee save register Reviewed-by: dnsimon, cslucas --- .../share/classes/jdk/vm/ci/code/RegisterConfig.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/RegisterConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/RegisterConfig.java index 09360885c0b..525930c8f3b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/RegisterConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/RegisterConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,6 +94,16 @@ public interface RegisterConfig { */ RegisterArray getCalleeSaveRegisters(); + /** + * Returns the storage kind for a callee-save register, which determines how the register is + * saved and restored. For example, according to the Windows x64 ABI, the upper portions of + * XMM0-XMM15 are considered destroyed, so saving the full width of these registers is not + * necessary. + */ + default PlatformKind getCalleeSaveRegisterStorageKind(Architecture arch, Register calleeSaveRegister) { + return arch.getLargestStorableKind(calleeSaveRegister.getRegisterCategory()); + } + /** * Gets a map from register {@linkplain Register#number numbers} to register * {@linkplain RegisterAttributes attributes} for this register configuration.