summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator_x86.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_x86.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_x86.cc')
-rw-r--r--compiler/optimizing/code_generator_x86.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 54bff0c..1764486 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -218,5 +218,32 @@ void InstructionCodeGeneratorX86::VisitInvokeStatic(HInvokeStatic* invoke) {
codegen_->RecordPcInfo(invoke->GetDexPc());
}
+void LocationsBuilderX86::VisitAdd(HAdd* add) {
+ LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(add);
+ switch (add->GetResultType()) {
+ case Primitive::kPrimInt: {
+ locations->SetInAt(0, Location(EAX));
+ locations->SetInAt(1, Location(ECX));
+ locations->SetOut(Location(EAX));
+ break;
+ }
+ default:
+ LOG(FATAL) << "Unimplemented";
+ }
+ add->SetLocations(locations);
+}
+
+void InstructionCodeGeneratorX86::VisitAdd(HAdd* add) {
+ LocationSummary* locations = add->GetLocations();
+ switch (add->GetResultType()) {
+ case Primitive::kPrimInt:
+ DCHECK_EQ(locations->InAt(0).reg<Register>(), locations->Out().reg<Register>());
+ __ addl(locations->InAt(0).reg<Register>(), locations->InAt(1).reg<Register>());
+ break;
+ default:
+ LOG(FATAL) << "Unimplemented";
+ }
+}
+
} // namespace x86
} // namespace art