Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_DEX_QUICK_ARM64_CODEGEN_ARM64_H_ |
| 18 | #define ART_COMPILER_DEX_QUICK_ARM64_CODEGEN_ARM64_H_ |
| 19 | |
| 20 | #include "arm64_lir.h" |
| 21 | #include "dex/compiler_internals.h" |
| 22 | |
| 23 | namespace art { |
| 24 | |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 25 | class Arm64Mir2Lir : public Mir2Lir { |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 26 | public: |
| 27 | Arm64Mir2Lir(CompilationUnit* cu, MIRGraph* mir_graph, ArenaAllocator* arena); |
| 28 | |
| 29 | // Required for target - codegen helpers. |
| 30 | bool SmallLiteralDivRem(Instruction::Code dalvik_opcode, bool is_div, RegLocation rl_src, |
| 31 | RegLocation rl_dest, int lit); |
| 32 | bool EasyMultiply(RegLocation rl_src, RegLocation rl_dest, int lit) OVERRIDE; |
| 33 | LIR* CheckSuspendUsingLoad() OVERRIDE; |
Andreas Gampe | 2f244e9 | 2014-05-08 03:35:25 -0700 | [diff] [blame] | 34 | RegStorage LoadHelper(ThreadOffset<4> offset) OVERRIDE; |
| 35 | RegStorage LoadHelper(ThreadOffset<8> offset) OVERRIDE; |
Vladimir Marko | 674744e | 2014-04-24 15:18:26 +0100 | [diff] [blame] | 36 | LIR* LoadBaseDispVolatile(RegStorage r_base, int displacement, RegStorage r_dest, |
| 37 | OpSize size) OVERRIDE; |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 38 | LIR* LoadBaseDisp(RegStorage r_base, int displacement, RegStorage r_dest, |
| 39 | OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 40 | LIR* LoadBaseIndexed(RegStorage r_base, RegStorage r_index, RegStorage r_dest, int scale, |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 41 | OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 42 | LIR* LoadBaseIndexedDisp(RegStorage r_base, RegStorage r_index, int scale, int displacement, |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 43 | RegStorage r_dest, OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 44 | LIR* LoadConstantNoClobber(RegStorage r_dest, int value); |
| 45 | LIR* LoadConstantWide(RegStorage r_dest, int64_t value); |
Vladimir Marko | 674744e | 2014-04-24 15:18:26 +0100 | [diff] [blame] | 46 | LIR* StoreBaseDispVolatile(RegStorage r_base, int displacement, RegStorage r_dest, |
| 47 | OpSize size) OVERRIDE; |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 48 | LIR* StoreBaseDisp(RegStorage r_base, int displacement, RegStorage r_src, |
| 49 | OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 50 | LIR* StoreBaseIndexed(RegStorage r_base, RegStorage r_index, RegStorage r_src, int scale, |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 51 | OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 52 | LIR* StoreBaseIndexedDisp(RegStorage r_base, RegStorage r_index, int scale, int displacement, |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 53 | RegStorage r_src, OpSize size) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 54 | void MarkGCCard(RegStorage val_reg, RegStorage tgt_addr_reg); |
| 55 | |
| 56 | // Required for target - register utilities. |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 57 | RegStorage TargetReg(SpecialTargetRegister reg); |
| 58 | RegStorage GetArgMappingToPhysicalReg(int arg_num); |
| 59 | RegLocation GetReturnAlt(); |
| 60 | RegLocation GetReturnWideAlt(); |
| 61 | RegLocation LocCReturn(); |
buzbee | a0cd2d7 | 2014-06-01 09:33:49 -0700 | [diff] [blame] | 62 | RegLocation LocCReturnRef(); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 63 | RegLocation LocCReturnDouble(); |
| 64 | RegLocation LocCReturnFloat(); |
| 65 | RegLocation LocCReturnWide(); |
Vladimir Marko | 8dea81c | 2014-06-06 14:50:36 +0100 | [diff] [blame] | 66 | ResourceMask GetRegMaskCommon(const RegStorage& reg) const OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 67 | void AdjustSpillMask(); |
| 68 | void ClobberCallerSave(); |
| 69 | void FreeCallTemps(); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 70 | void LockCallTemps(); |
| 71 | void MarkPreservedSingle(int v_reg, RegStorage reg); |
| 72 | void MarkPreservedDouble(int v_reg, RegStorage reg); |
| 73 | void CompilerInitializeRegAlloc(); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 74 | |
| 75 | // Required for target - miscellaneous. |
| 76 | void AssembleLIR(); |
| 77 | uint32_t LinkFixupInsns(LIR* head_lir, LIR* tail_lir, CodeOffset offset); |
| 78 | int AssignInsnOffsets(); |
| 79 | void AssignOffsets(); |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 80 | uint8_t* EncodeLIRs(uint8_t* write_pos, LIR* lir); |
Vladimir Marko | 8dea81c | 2014-06-06 14:50:36 +0100 | [diff] [blame] | 81 | void DumpResourceMask(LIR* lir, const ResourceMask& mask, const char* prefix) OVERRIDE; |
| 82 | void SetupTargetResourceMasks(LIR* lir, uint64_t flags, |
| 83 | ResourceMask* use_mask, ResourceMask* def_mask) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 84 | const char* GetTargetInstFmt(int opcode); |
| 85 | const char* GetTargetInstName(int opcode); |
| 86 | std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* base_addr); |
Vladimir Marko | 8dea81c | 2014-06-06 14:50:36 +0100 | [diff] [blame] | 87 | ResourceMask GetPCUseDefEncoding() const OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 88 | uint64_t GetTargetInstFlags(int opcode); |
| 89 | int GetInsnSize(LIR* lir); |
| 90 | bool IsUnconditionalBranch(LIR* lir); |
| 91 | |
Vladimir Marko | 674744e | 2014-04-24 15:18:26 +0100 | [diff] [blame] | 92 | // Check support for volatile load/store of a given size. |
| 93 | bool SupportsVolatileLoadStore(OpSize size) OVERRIDE; |
| 94 | // Get the register class for load/store of a field. |
| 95 | RegisterClass RegClassForFieldLoadStore(OpSize size, bool is_volatile) OVERRIDE; |
| 96 | |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 97 | // Required for target - Dalvik-level generators. |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame] | 98 | void GenShiftOpLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 99 | RegLocation lr_shift); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 100 | void GenArithImmOpLong(Instruction::Code opcode, RegLocation rl_dest, |
| 101 | RegLocation rl_src1, RegLocation rl_src2); |
| 102 | void GenArrayGet(int opt_flags, OpSize size, RegLocation rl_array, |
| 103 | RegLocation rl_index, RegLocation rl_dest, int scale); |
| 104 | void GenArrayPut(int opt_flags, OpSize size, RegLocation rl_array, RegLocation rl_index, |
| 105 | RegLocation rl_src, int scale, bool card_mark); |
| 106 | void GenShiftImmOpLong(Instruction::Code opcode, RegLocation rl_dest, |
| 107 | RegLocation rl_src1, RegLocation rl_shift); |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 108 | void GenLongOp(OpKind op, RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 109 | void GenMulLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 110 | RegLocation rl_src2); |
| 111 | void GenAddLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 112 | RegLocation rl_src2); |
| 113 | void GenAndLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 114 | RegLocation rl_src2); |
| 115 | void GenArithOpDouble(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 116 | RegLocation rl_src2); |
| 117 | void GenArithOpFloat(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 118 | RegLocation rl_src2); |
| 119 | void GenCmpFP(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 120 | RegLocation rl_src2); |
| 121 | void GenConversion(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src); |
| 122 | bool GenInlinedCas(CallInfo* info, bool is_long, bool is_object); |
| 123 | bool GenInlinedMinMaxInt(CallInfo* info, bool is_min); |
| 124 | bool GenInlinedSqrt(CallInfo* info); |
| 125 | bool GenInlinedPeek(CallInfo* info, OpSize size); |
| 126 | bool GenInlinedPoke(CallInfo* info, OpSize size); |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame] | 127 | void GenIntToLong(RegLocation rl_dest, RegLocation rl_src); |
| 128 | void GenNotLong(RegLocation rl_dest, RegLocation rl_src); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 129 | void GenNegLong(RegLocation rl_dest, RegLocation rl_src); |
| 130 | void GenOrLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 131 | RegLocation rl_src2); |
| 132 | void GenSubLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 133 | RegLocation rl_src2); |
| 134 | void GenXorLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 135 | RegLocation rl_src2); |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame] | 136 | void GenDivRemLong(Instruction::Code opcode, RegLocation rl_dest, RegLocation rl_src1, |
| 137 | RegLocation rl_src2, bool is_div); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 138 | RegLocation GenDivRem(RegLocation rl_dest, RegStorage reg_lo, RegStorage reg_hi, bool is_div); |
| 139 | RegLocation GenDivRemLit(RegLocation rl_dest, RegStorage reg_lo, int lit, bool is_div); |
| 140 | void GenCmpLong(RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2); |
| 141 | void GenDivZeroCheckWide(RegStorage reg); |
| 142 | void GenEntrySequence(RegLocation* ArgLocs, RegLocation rl_method); |
| 143 | void GenExitSequence(); |
| 144 | void GenSpecialExitSequence(); |
| 145 | void GenFillArrayData(DexOffset table_offset, RegLocation rl_src); |
| 146 | void GenFusedFPCmpBranch(BasicBlock* bb, MIR* mir, bool gt_bias, bool is_double); |
| 147 | void GenFusedLongCmpBranch(BasicBlock* bb, MIR* mir); |
| 148 | void GenSelect(BasicBlock* bb, MIR* mir); |
Andreas Gampe | b14329f | 2014-05-15 11:16:06 -0700 | [diff] [blame] | 149 | bool GenMemBarrier(MemBarrierKind barrier_kind); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 150 | void GenMonitorEnter(int opt_flags, RegLocation rl_src); |
| 151 | void GenMonitorExit(int opt_flags, RegLocation rl_src); |
| 152 | void GenMoveException(RegLocation rl_dest); |
| 153 | void GenMultiplyByTwoBitMultiplier(RegLocation rl_src, RegLocation rl_result, int lit, |
| 154 | int first_bit, int second_bit); |
| 155 | void GenNegDouble(RegLocation rl_dest, RegLocation rl_src); |
| 156 | void GenNegFloat(RegLocation rl_dest, RegLocation rl_src); |
| 157 | void GenPackedSwitch(MIR* mir, DexOffset table_offset, RegLocation rl_src); |
| 158 | void GenSparseSwitch(MIR* mir, DexOffset table_offset, RegLocation rl_src); |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 159 | bool GenSpecialCase(BasicBlock* bb, MIR* mir, const InlineMethod& special); |
| 160 | |
| 161 | uint32_t GenPairWise(uint32_t reg_mask, int* reg1, int* reg2); |
| 162 | void UnSpillCoreRegs(RegStorage base, int offset, uint32_t reg_mask); |
| 163 | void SpillCoreRegs(RegStorage base, int offset, uint32_t reg_mask); |
Matteo Franchin | bc6d197 | 2014-05-13 12:33:28 +0100 | [diff] [blame] | 164 | void UnSpillFPRegs(RegStorage base, int offset, uint32_t reg_mask); |
| 165 | void SpillFPRegs(RegStorage base, int offset, uint32_t reg_mask); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 166 | |
| 167 | // Required for target - single operation generators. |
| 168 | LIR* OpUnconditionalBranch(LIR* target); |
| 169 | LIR* OpCmpBranch(ConditionCode cond, RegStorage src1, RegStorage src2, LIR* target); |
| 170 | LIR* OpCmpImmBranch(ConditionCode cond, RegStorage reg, int check_value, LIR* target); |
| 171 | LIR* OpCondBranch(ConditionCode cc, LIR* target); |
| 172 | LIR* OpDecAndBranch(ConditionCode c_code, RegStorage reg, LIR* target); |
| 173 | LIR* OpFpRegCopy(RegStorage r_dest, RegStorage r_src); |
| 174 | LIR* OpIT(ConditionCode cond, const char* guide); |
| 175 | void OpEndIT(LIR* it); |
| 176 | LIR* OpMem(OpKind op, RegStorage r_base, int disp); |
| 177 | LIR* OpPcRelLoad(RegStorage reg, LIR* target); |
| 178 | LIR* OpReg(OpKind op, RegStorage r_dest_src); |
| 179 | void OpRegCopy(RegStorage r_dest, RegStorage r_src); |
| 180 | LIR* OpRegCopyNoInsert(RegStorage r_dest, RegStorage r_src); |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame] | 181 | LIR* OpRegImm64(OpKind op, RegStorage r_dest_src1, int64_t value); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 182 | LIR* OpRegImm(OpKind op, RegStorage r_dest_src1, int value); |
| 183 | LIR* OpRegMem(OpKind op, RegStorage r_dest, RegStorage r_base, int offset); |
| 184 | LIR* OpRegReg(OpKind op, RegStorage r_dest_src1, RegStorage r_src2); |
| 185 | LIR* OpMovRegMem(RegStorage r_dest, RegStorage r_base, int offset, MoveType move_type); |
| 186 | LIR* OpMovMemReg(RegStorage r_base, int offset, RegStorage r_src, MoveType move_type); |
| 187 | LIR* OpCondRegReg(OpKind op, ConditionCode cc, RegStorage r_dest, RegStorage r_src); |
Zheng Xu | e2eb29e | 2014-06-12 10:22:33 +0800 | [diff] [blame^] | 188 | LIR* OpRegRegImm64(OpKind op, RegStorage r_dest, RegStorage r_src1, int64_t value); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 189 | LIR* OpRegRegImm(OpKind op, RegStorage r_dest, RegStorage r_src1, int value); |
| 190 | LIR* OpRegRegReg(OpKind op, RegStorage r_dest, RegStorage r_src1, RegStorage r_src2); |
| 191 | LIR* OpTestSuspend(LIR* target); |
Andreas Gampe | 2f244e9 | 2014-05-08 03:35:25 -0700 | [diff] [blame] | 192 | LIR* OpThreadMem(OpKind op, ThreadOffset<4> thread_offset) OVERRIDE; |
| 193 | LIR* OpThreadMem(OpKind op, ThreadOffset<8> thread_offset) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 194 | LIR* OpVldm(RegStorage r_base, int count); |
| 195 | LIR* OpVstm(RegStorage r_base, int count); |
| 196 | void OpLea(RegStorage r_base, RegStorage reg1, RegStorage reg2, int scale, int offset); |
| 197 | void OpRegCopyWide(RegStorage dest, RegStorage src); |
Andreas Gampe | 2f244e9 | 2014-05-08 03:35:25 -0700 | [diff] [blame] | 198 | void OpTlsCmp(ThreadOffset<4> offset, int val) OVERRIDE; |
| 199 | void OpTlsCmp(ThreadOffset<8> offset, int val) OVERRIDE; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 200 | |
Vladimir Marko | 3bf7c60 | 2014-05-07 14:55:43 +0100 | [diff] [blame] | 201 | LIR* LoadBaseDispBody(RegStorage r_base, int displacement, RegStorage r_dest, OpSize size); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 202 | LIR* StoreBaseDispBody(RegStorage r_base, int displacement, RegStorage r_src, OpSize size); |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame] | 203 | LIR* OpRegRegRegShift(OpKind op, RegStorage r_dest, RegStorage r_src1, RegStorage r_src2, |
| 204 | int shift); |
Matteo Franchin | bc6d197 | 2014-05-13 12:33:28 +0100 | [diff] [blame] | 205 | LIR* OpRegRegShift(OpKind op, RegStorage r_dest_src1, RegStorage r_src2, int shift); |
Stuart Monteith | f8ec48e | 2014-06-06 17:05:08 +0100 | [diff] [blame] | 206 | LIR* OpRegRegExtend(OpKind op, RegStorage r_dest_src1, RegStorage r_src2, int shift); |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 207 | static const ArmEncodingMap EncodingMap[kA64Last]; |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 208 | int EncodeShift(int code, int amount); |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 209 | int EncodeExtend(int extend_type, int amount); |
| 210 | bool IsExtendEncoding(int encoded_value); |
| 211 | int EncodeLogicalImmediate(bool is_wide, uint64_t value); |
| 212 | uint64_t DecodeLogicalImmediate(bool is_wide, int value); |
| 213 | |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 214 | ArmConditionCode ArmConditionEncoding(ConditionCode code); |
| 215 | bool InexpensiveConstantInt(int32_t value); |
| 216 | bool InexpensiveConstantFloat(int32_t value); |
| 217 | bool InexpensiveConstantLong(int64_t value); |
| 218 | bool InexpensiveConstantDouble(int64_t value); |
| 219 | |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 220 | void FlushIns(RegLocation* ArgLocs, RegLocation rl_method); |
| 221 | int LoadArgRegs(CallInfo* info, int call_state, |
| 222 | NextCallInsn next_call_insn, |
| 223 | const MethodReference& target_method, |
| 224 | uint32_t vtable_idx, |
| 225 | uintptr_t direct_code, uintptr_t direct_method, InvokeType type, |
| 226 | bool skip_this); |
| 227 | |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 228 | private: |
Matteo Franchin | 5acc8b0 | 2014-06-05 15:10:35 +0100 | [diff] [blame] | 229 | /** |
| 230 | * @brief Given register xNN (dNN), returns register wNN (sNN). |
| 231 | * @param reg #RegStorage containing a Solo64 input register (e.g. @c x1 or @c d2). |
| 232 | * @return A Solo32 with the same register number as the @p reg (e.g. @c w1 or @c s2). |
| 233 | * @see As64BitReg |
| 234 | */ |
| 235 | RegStorage As32BitReg(RegStorage reg) { |
| 236 | DCHECK(reg.Is64Bit()); |
| 237 | DCHECK(!reg.IsPair()); |
| 238 | RegStorage ret_val = RegStorage(RegStorage::k32BitSolo, |
| 239 | reg.GetRawBits() & RegStorage::kRegTypeMask); |
| 240 | DCHECK_EQ(GetRegInfo(reg)->FindMatchingView(RegisterInfo::k32SoloStorageMask) |
| 241 | ->GetReg().GetReg(), |
| 242 | ret_val.GetReg()); |
| 243 | return ret_val; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * @brief Given register wNN (sNN), returns register xNN (dNN). |
| 248 | * @param reg #RegStorage containing a Solo32 input register (e.g. @c w1 or @c s2). |
| 249 | * @return A Solo64 with the same register number as the @p reg (e.g. @c x1 or @c d2). |
| 250 | * @see As32BitReg |
| 251 | */ |
| 252 | RegStorage As64BitReg(RegStorage reg) { |
| 253 | DCHECK(reg.Is32Bit()); |
| 254 | DCHECK(!reg.IsPair()); |
| 255 | RegStorage ret_val = RegStorage(RegStorage::k64BitSolo, |
| 256 | reg.GetRawBits() & RegStorage::kRegTypeMask); |
| 257 | DCHECK_EQ(GetRegInfo(reg)->FindMatchingView(RegisterInfo::k64SoloStorageMask) |
| 258 | ->GetReg().GetReg(), |
| 259 | ret_val.GetReg()); |
| 260 | return ret_val; |
| 261 | } |
| 262 | |
Matteo Franchin | e45fb9e | 2014-05-06 10:10:30 +0100 | [diff] [blame] | 263 | LIR* LoadFPConstantValue(int r_dest, int32_t value); |
| 264 | LIR* LoadFPConstantValueWide(int r_dest, int64_t value); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 265 | void ReplaceFixup(LIR* prev_lir, LIR* orig_lir, LIR* new_lir); |
| 266 | void InsertFixupBefore(LIR* prev_lir, LIR* orig_lir, LIR* new_lir); |
| 267 | void AssignDataOffsets(); |
| 268 | RegLocation GenDivRem(RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2, |
| 269 | bool is_div, bool check_zero); |
| 270 | RegLocation GenDivRemLit(RegLocation rl_dest, RegLocation rl_src1, int lit, bool is_div); |
Matteo Franchin | 43ec873 | 2014-03-31 15:00:14 +0100 | [diff] [blame] | 271 | }; |
| 272 | |
| 273 | } // namespace art |
| 274 | |
| 275 | #endif // ART_COMPILER_DEX_QUICK_ARM64_CODEGEN_ARM64_H_ |