diff options
author | Vladimir Marko <vmarko@google.com> | 2020-04-09 13:20:11 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2020-04-17 15:43:48 +0000 |
commit | 5f84607854775be67a8eb2437ce1071af7d477d2 (patch) | |
tree | 4d28da38b7170fad07ce08878cedb239f51279da /compiler/optimizing/instruction_builder.h | |
parent | c8150b5def82058c23df377a5006a78e7668afeb (diff) |
Optimizing: Construct intrinsic HIR in builder.
To help baseline compiler emit better code, construct
intermediate representation for intrinsics that have
corresponding HIR classes in the instruction builder,
instead of doing it in the instruction simplifier.
Note: The generated code is sometimes different than
before because GVN uses instruction ids for input
ordering for commutative operations.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Change-Id: Ifa3a5774f8f3fbff4e3ca359c38eceee993d62cd
Diffstat (limited to 'compiler/optimizing/instruction_builder.h')
-rw-r--r-- | compiler/optimizing/instruction_builder.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h index c0211342ff..95d331558f 100644 --- a/compiler/optimizing/instruction_builder.h +++ b/compiler/optimizing/instruction_builder.h @@ -243,17 +243,22 @@ class HInstructionBuilder : public ValueObject { uint32_t dex_pc, HInvoke* invoke); - bool SetupInvokeArguments(HInvoke* invoke, + enum class ReceiverArg { + kNone, // No receiver, static method. + kNullCheckedArg, // Normal instance invoke, null check and pass the argument. + kNullCheckedOnly, // Null check but do not use the arg, used for intrinsic replacements. + kPlainArg, // Do not null check but pass the argument, used for unresolved methods. + kIgnored, // No receiver despite allocated vreg, used for String.<init>. + }; + bool SetupInvokeArguments(HInstruction* invoke, const InstructionOperands& operands, const char* shorty, - size_t start_index, - size_t* argument_index); + ReceiverArg receiver_arg); bool HandleInvoke(HInvoke* invoke, const InstructionOperands& operands, const char* shorty, - bool is_unresolved, - HClinitCheck* clinit_check = nullptr); + bool is_unresolved); bool HandleStringInit(HInvoke* invoke, const InstructionOperands& operands, @@ -265,6 +270,14 @@ class HInstructionBuilder : public ValueObject { ArtMethod* method, HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement); + // Try to build a replacement for an intrinsic invoke. Returns true on success, + // false on failure. Failure can be either lack of replacement HIR classes, or + // input register mismatch. + bool BuildSimpleIntrinsic(ArtMethod* method, + uint32_t dex_pc, + const InstructionOperands& operands, + const char* shorty); + // Build a HNewInstance instruction. HNewInstance* BuildNewInstance(dex::TypeIndex type_index, uint32_t dex_pc); |