summaryrefslogtreecommitdiff
path: root/compiler/utils/arm64/assembler_arm64.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2019-07-05 13:37:42 +0100
committer Vladimir Marko <vmarko@google.com> 2019-07-18 13:37:15 +0000
commit1a225a76ee6bc29833aee048b6cfae20242bdc8b (patch)
tree069bfc01d827fcbf9aa4415c4d63d354648f396c /compiler/utils/arm64/assembler_arm64.h
parent323844002e54243e295497e7f829e46a533da621 (diff)
ARM/ARM64: Improve frame entry/exit codegen.
On ARM64, use STP pre-index for the method and the lowest spilled core register for method entry if there's no gap or FP spills in between. On exit, use LDP post-index to restore in this case, ignoring the method by loading to XZR. Thus, we save one instruction for both entry end exit for such methods and the performance should be the same or better. On ARM, use a single PUSH/POP for method entry and core spills if the gap between them is 2 words or less and and we have one or no FP spill, spill args as filler if needed. On exit, load the FP spill if any and do a single POP for core registers and return in this situation, clobbering as many registers from r2-r4 as needed; these caller-save registers are not used to pass return values. If we cannot do this because of FP spills but the gap between the method and FP spills is 2 words or less, we adjust SP and save the method in one PUSH after spilling; there is no similar handling for method exit as the method does not need to be restored. This may improve or degrade performance a bit depending on the particular situation; in the worst case we PUSH/POP three additional registers as a cost for smaller code size. aosp_taimen-userdebug prebuils: - before: arm/boot*.oat: 19147484 arm64/boot*.oat: 22558344 oat/arm/services.odex: 21922256 - after: arm/boot*.oat: 19105436 (-41KiB, -0.2%) arm64/boot*.oat: 22549624 (-9KiB, -0.04%) oat/arm/services.odex: 21914128 (-8KiB, -0.04%) Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 136144107 Change-Id: Id36c67b4e735418fb18bcd3269b72b25695fbaa2
Diffstat (limited to 'compiler/utils/arm64/assembler_arm64.h')
-rw-r--r--compiler/utils/arm64/assembler_arm64.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/utils/arm64/assembler_arm64.h b/compiler/utils/arm64/assembler_arm64.h
index 9e01a70ea9..594c6b4b75 100644
--- a/compiler/utils/arm64/assembler_arm64.h
+++ b/compiler/utils/arm64/assembler_arm64.h
@@ -25,6 +25,7 @@
#include "base/arena_containers.h"
#include "base/macros.h"
+#include "dwarf/register.h"
#include "offsets.h"
#include "utils/arm64/managed_register_arm64.h"
#include "utils/assembler.h"
@@ -42,6 +43,15 @@ class Arm64InstructionSetFeatures;
namespace arm64 {
+static inline dwarf::Reg DWARFReg(vixl::aarch64::CPURegister reg) {
+ if (reg.IsFPRegister()) {
+ return dwarf::Reg::Arm64Fp(reg.GetCode());
+ } else {
+ DCHECK_LT(reg.GetCode(), 31u); // X0 - X30.
+ return dwarf::Reg::Arm64Core(reg.GetCode());
+ }
+}
+
#define MEM_OP(...) vixl::aarch64::MemOperand(__VA_ARGS__)
enum LoadOperandType {