summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator_arm.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-03-28 15:43:40 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-03-31 11:41:39 +0100
commitd8ee737fdbf380c5bb90c9270c8d1087ac23e76c (patch)
treebecdbf2b4e2a3c84952bd7b1db60a2daccd47206 /compiler/optimizing/code_generator_arm.cc
parent7f466c08888129a9923cb973a4dc73ee4a71574e (diff)
downloadart-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.zip
art-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.tar.gz
art-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.tar.bz2
Add support for adding two integers in optimizing compiler.
Change-Id: I5524e193cd07f2692a57c6b4f8069904471b2928
Diffstat (limited to 'compiler/optimizing/code_generator_arm.cc')
-rw-r--r--compiler/optimizing/code_generator_arm.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc
index c85d67d..68c997b 100644
--- a/compiler/optimizing/code_generator_arm.cc
+++ b/compiler/optimizing/code_generator_arm.cc
@@ -221,5 +221,33 @@ void InstructionCodeGeneratorARM::VisitInvokeStatic(HInvokeStatic* invoke) {
codegen_->RecordPcInfo(invoke->GetDexPc());
}
+void LocationsBuilderARM::VisitAdd(HAdd* add) {
+ LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(add);
+ switch (add->GetResultType()) {
+ case Primitive::kPrimInt: {
+ locations->SetInAt(0, Location(R0));
+ locations->SetInAt(1, Location(R1));
+ locations->SetOut(Location(R0));
+ break;
+ }
+ default:
+ LOG(FATAL) << "Unimplemented";
+ }
+ add->SetLocations(locations);
+}
+
+void InstructionCodeGeneratorARM::VisitAdd(HAdd* add) {
+ LocationSummary* locations = add->GetLocations();
+ switch (add->GetResultType()) {
+ case Primitive::kPrimInt:
+ __ add(locations->Out().reg<Register>(),
+ locations->InAt(0).reg<Register>(),
+ ShifterOperand(locations->InAt(1).reg<Register>()));
+ break;
+ default:
+ LOG(FATAL) << "Unimplemented";
+ }
+}
+
} // namespace arm
} // namespace art