blob: 4e88765e2c187d2089bd54a527cfc5de8fdcfd6d [file] [log] [blame]
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +00001/*
2 * Copyright (C) 2014 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#include "code_generator_arm.h"
18#include "utils/assembler.h"
19#include "utils/arm/assembler_arm.h"
20
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +000021#include "mirror/array.h"
22#include "mirror/art_method.h"
23
Nicolas Geoffray787c3072014-03-17 10:20:19 +000024#define __ reinterpret_cast<ArmAssembler*>(GetAssembler())->
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000025
26namespace art {
27namespace arm {
28
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010029static constexpr int kNumberOfPushedRegistersAtEntry = 1;
30static constexpr int kCurrentMethodStackOffset = 0;
31
32InstructionCodeGeneratorARM::InstructionCodeGeneratorARM(HGraph* graph, CodeGeneratorARM* codegen)
33 : HGraphVisitor(graph),
34 assembler_(codegen->GetAssembler()),
35 codegen_(codegen) {}
36
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000037void CodeGeneratorARM::GenerateFrameEntry() {
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +000038 core_spill_mask_ |= (1 << LR);
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010039 __ PushList((1 << LR));
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +000040
Nicolas Geoffrayf583e592014-04-07 13:20:42 +010041 // Add the current ART method to the frame size, the return PC, and the filler.
42 SetFrameSize(RoundUp((
43 GetGraph()->GetMaximumNumberOfOutVRegs() + GetGraph()->GetNumberOfVRegs() + 3) * kArmWordSize,
44 kStackAlignment));
45 // The return PC has already been pushed on the stack.
Nicolas Geoffray707c8092014-04-04 10:50:14 +010046 __ AddConstant(SP, -(GetFrameSize() - kNumberOfPushedRegistersAtEntry * kArmWordSize));
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +000047 __ str(R0, Address(SP, 0));
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000048}
49
50void CodeGeneratorARM::GenerateFrameExit() {
Nicolas Geoffray707c8092014-04-04 10:50:14 +010051 __ AddConstant(SP, GetFrameSize() - kNumberOfPushedRegistersAtEntry * kArmWordSize);
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010052 __ PopList((1 << PC));
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000053}
54
55void CodeGeneratorARM::Bind(Label* label) {
56 __ Bind(label);
57}
58
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010059int32_t CodeGeneratorARM::GetStackSlot(HLocal* local) const {
Nicolas Geoffrayf583e592014-04-07 13:20:42 +010060 uint16_t reg_number = local->GetRegNumber();
61 uint16_t number_of_vregs = GetGraph()->GetNumberOfVRegs();
62 uint16_t number_of_in_vregs = GetGraph()->GetNumberOfInVRegs();
63 if (reg_number >= number_of_vregs - number_of_in_vregs) {
64 // Local is a parameter of the method. It is stored in the caller's frame.
65 return GetFrameSize() + kArmWordSize // ART method
66 + (reg_number - number_of_vregs + number_of_in_vregs) * kArmWordSize;
67 } else {
68 // Local is a temporary in this method. It is stored in this method's frame.
69 return GetFrameSize() - (kNumberOfPushedRegistersAtEntry * kArmWordSize)
70 - kArmWordSize // filler.
71 - (number_of_vregs * kArmWordSize)
72 + (reg_number * kArmWordSize);
73 }
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000074}
75
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010076void CodeGeneratorARM::Move(HInstruction* instruction, Location location, HInstruction* move_for) {
77 if (instruction->AsIntConstant() != nullptr) {
78 __ LoadImmediate(location.reg<Register>(), instruction->AsIntConstant()->GetValue());
79 } else if (instruction->AsLoadLocal() != nullptr) {
80 __ LoadFromOffset(kLoadWord, location.reg<Register>(),
81 SP, GetStackSlot(instruction->AsLoadLocal()->GetLocal()));
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000082 } else {
Nicolas Geoffray4a34a422014-04-03 10:38:37 +010083 // This can currently only happen when the instruction that requests the move
84 // is the next to be compiled.
85 DCHECK_EQ(instruction->GetNext(), move_for);
86 __ mov(location.reg<Register>(),
87 ShifterOperand(instruction->GetLocations()->Out().reg<Register>()));
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000088 }
89}
90
91void LocationsBuilderARM::VisitGoto(HGoto* got) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +000092 got->SetLocations(nullptr);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000093}
94
Nicolas Geoffray787c3072014-03-17 10:20:19 +000095void InstructionCodeGeneratorARM::VisitGoto(HGoto* got) {
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000096 HBasicBlock* successor = got->GetSuccessor();
Nicolas Geoffray787c3072014-03-17 10:20:19 +000097 if (GetGraph()->GetExitBlock() == successor) {
98 codegen_->GenerateFrameExit();
99 } else if (!codegen_->GoesToNextBlock(got->GetBlock(), successor)) {
100 __ b(codegen_->GetLabelOf(successor));
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000101 }
102}
103
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000104void LocationsBuilderARM::VisitExit(HExit* exit) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000105 exit->SetLocations(nullptr);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000106}
107
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000108void InstructionCodeGeneratorARM::VisitExit(HExit* exit) {
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000109 if (kIsDebugBuild) {
110 __ Comment("Unreachable");
111 __ bkpt(0);
112 }
113}
114
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000115void LocationsBuilderARM::VisitIf(HIf* if_instr) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000116 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(if_instr);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000117 locations->SetInAt(0, Location(R0));
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000118 if_instr->SetLocations(locations);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000119}
120
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000121void InstructionCodeGeneratorARM::VisitIf(HIf* if_instr) {
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000122 // TODO: Generate the input as a condition, instead of materializing in a register.
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000123 __ cmp(if_instr->GetLocations()->InAt(0).reg<Register>(), ShifterOperand(0));
124 __ b(codegen_->GetLabelOf(if_instr->IfFalseSuccessor()), EQ);
125 if (!codegen_->GoesToNextBlock(if_instr->GetBlock(), if_instr->IfTrueSuccessor())) {
126 __ b(codegen_->GetLabelOf(if_instr->IfTrueSuccessor()));
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000127 }
128}
129
130void LocationsBuilderARM::VisitEqual(HEqual* equal) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000131 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(equal);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000132 locations->SetInAt(0, Location(R0));
133 locations->SetInAt(1, Location(R1));
134 locations->SetOut(Location(R0));
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000135 equal->SetLocations(locations);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000136}
137
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000138void InstructionCodeGeneratorARM::VisitEqual(HEqual* equal) {
139 LocationSummary* locations = equal->GetLocations();
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000140 __ teq(locations->InAt(0).reg<Register>(),
141 ShifterOperand(locations->InAt(1).reg<Register>()));
142 __ mov(locations->Out().reg<Register>(), ShifterOperand(1), EQ);
143 __ mov(locations->Out().reg<Register>(), ShifterOperand(0), NE);
144}
145
146void LocationsBuilderARM::VisitLocal(HLocal* local) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000147 local->SetLocations(nullptr);
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000148}
149
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000150void InstructionCodeGeneratorARM::VisitLocal(HLocal* local) {
151 DCHECK_EQ(local->GetBlock(), GetGraph()->GetEntryBlock());
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000152}
153
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000154void LocationsBuilderARM::VisitLoadLocal(HLoadLocal* load) {
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100155 load->SetLocations(nullptr);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000156}
157
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000158void InstructionCodeGeneratorARM::VisitLoadLocal(HLoadLocal* load) {
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100159 // Nothing to do, this is driven by the code generator.
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000160}
161
162void LocationsBuilderARM::VisitStoreLocal(HStoreLocal* store) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000163 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(store);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000164 locations->SetInAt(1, Location(R0));
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000165 store->SetLocations(locations);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000166}
167
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000168void InstructionCodeGeneratorARM::VisitStoreLocal(HStoreLocal* store) {
169 LocationSummary* locations = store->GetLocations();
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000170 __ StoreToOffset(kStoreWord, locations->InAt(1).reg<Register>(),
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100171 SP, codegen_->GetStackSlot(store->GetLocal()));
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000172}
173
174void LocationsBuilderARM::VisitIntConstant(HIntConstant* constant) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000175 constant->SetLocations(nullptr);
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000176}
177
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000178void InstructionCodeGeneratorARM::VisitIntConstant(HIntConstant* constant) {
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000179 // Will be generated at use site.
180}
181
182void LocationsBuilderARM::VisitReturnVoid(HReturnVoid* ret) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000183 ret->SetLocations(nullptr);
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000184}
185
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000186void InstructionCodeGeneratorARM::VisitReturnVoid(HReturnVoid* ret) {
187 codegen_->GenerateFrameExit();
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000188}
189
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000190void LocationsBuilderARM::VisitReturn(HReturn* ret) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000191 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(ret);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000192 locations->SetInAt(0, Location(R0));
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000193 ret->SetLocations(locations);
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000194}
195
Nicolas Geoffray787c3072014-03-17 10:20:19 +0000196void InstructionCodeGeneratorARM::VisitReturn(HReturn* ret) {
197 DCHECK_EQ(ret->GetLocations()->InAt(0).reg<Register>(), R0);
198 codegen_->GenerateFrameExit();
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000199}
200
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100201static constexpr Register kParameterCoreRegisters[] = { R1, R2, R3 };
Nicolas Geoffray2e7038a2014-04-03 18:49:58 +0100202static constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters);
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100203
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100204class InvokeDexCallingConvention : public CallingConvention<Register> {
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100205 public:
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100206 InvokeDexCallingConvention()
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100207 : CallingConvention(kParameterCoreRegisters, kParameterCoreRegistersLength) {}
208
209 private:
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100210 DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention);
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100211};
212
213void LocationsBuilderARM::VisitPushArgument(HPushArgument* argument) {
214 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(argument);
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100215 InvokeDexCallingConvention calling_convention;
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100216 if (argument->GetArgumentIndex() < calling_convention.GetNumberOfRegisters()) {
217 Location location = Location(calling_convention.GetRegisterAt(argument->GetArgumentIndex()));
218 locations->SetInAt(0, location);
219 locations->SetOut(location);
220 } else {
221 locations->SetInAt(0, Location(R0));
222 }
223 argument->SetLocations(locations);
224}
225
226void InstructionCodeGeneratorARM::VisitPushArgument(HPushArgument* argument) {
227 uint8_t argument_index = argument->GetArgumentIndex();
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100228 InvokeDexCallingConvention calling_convention;
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100229 size_t parameter_registers = calling_convention.GetNumberOfRegisters();
230 LocationSummary* locations = argument->GetLocations();
231 if (argument_index >= parameter_registers) {
232 uint8_t offset = calling_convention.GetStackOffsetOf(argument_index);
233 __ StoreToOffset(kStoreWord, locations->InAt(0).reg<Register>(), SP, offset);
234 } else {
235 DCHECK_EQ(locations->Out().reg<Register>(), locations->InAt(0).reg<Register>());
236 }
237}
238
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +0000239void LocationsBuilderARM::VisitInvokeStatic(HInvokeStatic* invoke) {
240 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(invoke);
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +0000241 locations->AddTemp(Location(R0));
242 invoke->SetLocations(locations);
243}
244
245void InstructionCodeGeneratorARM::LoadCurrentMethod(Register reg) {
Nicolas Geoffray4a34a422014-04-03 10:38:37 +0100246 __ ldr(reg, Address(SP, kCurrentMethodStackOffset));
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +0000247}
248
249void InstructionCodeGeneratorARM::VisitInvokeStatic(HInvokeStatic* invoke) {
250 Register temp = invoke->GetLocations()->GetTemp(0).reg<Register>();
251 size_t index_in_cache = mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
Nicolas Geoffray707c8092014-04-04 10:50:14 +0100252 invoke->GetIndexInDexCache() * kArmWordSize;
Nicolas Geoffray8ccc3f52014-03-19 10:34:11 +0000253
254 // TODO: Implement all kinds of calls:
255 // 1) boot -> boot
256 // 2) app -> boot
257 // 3) app -> app
258 //
259 // Currently we implement the app -> app logic, which looks up in the resolve cache.
260
261 // temp = method;
262 LoadCurrentMethod(temp);
263 // temp = temp->dex_cache_resolved_methods_;
264 __ ldr(temp, Address(temp, mirror::ArtMethod::DexCacheResolvedMethodsOffset().Int32Value()));
265 // temp = temp[index_in_cache]
266 __ ldr(temp, Address(temp, index_in_cache));
267 // LR = temp[offset_of_quick_compiled_code]
268 __ ldr(LR, Address(temp,
269 mirror::ArtMethod::EntryPointFromQuickCompiledCodeOffset().Int32Value()));
270 // LR()
271 __ blx(LR);
272
273 codegen_->RecordPcInfo(invoke->GetDexPc());
274}
275
Nicolas Geoffrayd8ee7372014-03-28 15:43:40 +0000276void LocationsBuilderARM::VisitAdd(HAdd* add) {
277 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(add);
278 switch (add->GetResultType()) {
279 case Primitive::kPrimInt: {
280 locations->SetInAt(0, Location(R0));
281 locations->SetInAt(1, Location(R1));
282 locations->SetOut(Location(R0));
283 break;
284 }
285 default:
286 LOG(FATAL) << "Unimplemented";
287 }
288 add->SetLocations(locations);
289}
290
291void InstructionCodeGeneratorARM::VisitAdd(HAdd* add) {
292 LocationSummary* locations = add->GetLocations();
293 switch (add->GetResultType()) {
294 case Primitive::kPrimInt:
295 __ add(locations->Out().reg<Register>(),
296 locations->InAt(0).reg<Register>(),
297 ShifterOperand(locations->InAt(1).reg<Register>()));
298 break;
299 default:
300 LOG(FATAL) << "Unimplemented";
301 }
302}
303
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100304void LocationsBuilderARM::VisitSub(HSub* sub) {
305 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(sub);
306 switch (sub->GetResultType()) {
307 case Primitive::kPrimInt: {
308 locations->SetInAt(0, Location(R0));
309 locations->SetInAt(1, Location(R1));
310 locations->SetOut(Location(R0));
311 break;
312 }
313 default:
314 LOG(FATAL) << "Unimplemented";
315 }
316 sub->SetLocations(locations);
317}
318
319void InstructionCodeGeneratorARM::VisitSub(HSub* sub) {
320 LocationSummary* locations = sub->GetLocations();
321 switch (sub->GetResultType()) {
322 case Primitive::kPrimInt:
323 __ sub(locations->Out().reg<Register>(),
324 locations->InAt(0).reg<Register>(),
325 ShifterOperand(locations->InAt(1).reg<Register>()));
326 break;
327 default:
328 LOG(FATAL) << "Unimplemented";
329 }
330}
331
Nicolas Geoffray2e7038a2014-04-03 18:49:58 +0100332static constexpr Register kRuntimeParameterCoreRegisters[] = { R0, R1 };
333static constexpr size_t kRuntimeParameterCoreRegistersLength =
334 arraysize(kRuntimeParameterCoreRegisters);
335
336class InvokeRuntimeCallingConvention : public CallingConvention<Register> {
337 public:
338 InvokeRuntimeCallingConvention()
339 : CallingConvention(kRuntimeParameterCoreRegisters,
340 kRuntimeParameterCoreRegistersLength) {}
341
342 private:
343 DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConvention);
344};
345
346void LocationsBuilderARM::VisitNewInstance(HNewInstance* instruction) {
347 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction);
348 locations->SetOut(Location(R0));
349 instruction->SetLocations(locations);
350}
351
352void InstructionCodeGeneratorARM::VisitNewInstance(HNewInstance* instruction) {
353 InvokeRuntimeCallingConvention calling_convention;
354 LoadCurrentMethod(calling_convention.GetRegisterAt(1));
355 __ LoadImmediate(calling_convention.GetRegisterAt(0), instruction->GetTypeIndex());
356
Nicolas Geoffray707c8092014-04-04 10:50:14 +0100357 int32_t offset = QUICK_ENTRYPOINT_OFFSET(kArmWordSize, pAllocObjectWithAccessCheck).Int32Value();
Nicolas Geoffray2e7038a2014-04-03 18:49:58 +0100358 __ ldr(LR, Address(TR, offset));
359 __ blx(LR);
360
361 codegen_->RecordPcInfo(instruction->GetDexPc());
362}
363
Nicolas Geoffrayf583e592014-04-07 13:20:42 +0100364void LocationsBuilderARM::VisitParameterValue(HParameterValue* instruction) {
365 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction);
366 InvokeDexCallingConvention calling_convention;
367 uint32_t argument_index = instruction->GetIndex();
368 if (argument_index < calling_convention.GetNumberOfRegisters()) {
369 locations->SetOut(Location(calling_convention.GetRegisterAt(argument_index)));
370 } else {
371 locations->SetOut(Location(R0));
372 }
373 instruction->SetLocations(locations);
374}
375
376void InstructionCodeGeneratorARM::VisitParameterValue(HParameterValue* instruction) {
377 LocationSummary* locations = instruction->GetLocations();
378 InvokeDexCallingConvention calling_convention;
379 uint8_t argument_index = instruction->GetIndex();
380 if (argument_index >= calling_convention.GetNumberOfRegisters()) {
381 uint8_t offset = calling_convention.GetStackOffsetOf(argument_index);
382 __ ldr(locations->Out().reg<Register>(), Address(SP, offset + codegen_->GetFrameSize()));
383 }
384}
385
Nicolas Geoffrayb55f8352014-04-07 15:26:35 +0100386void LocationsBuilderARM::VisitNot(HNot* instruction) {
387 LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction);
388 locations->SetInAt(0, Location(R0));
389 locations->SetOut(Location(R0));
390 instruction->SetLocations(locations);
391}
392
393void InstructionCodeGeneratorARM::VisitNot(HNot* instruction) {
394 LocationSummary* locations = instruction->GetLocations();
395 __ eor(locations->Out().reg<Register>(), locations->InAt(0).reg<Register>(), ShifterOperand(1));
396}
397
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000398} // namespace arm
399} // namespace art