Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: src/IceInstX8632.cpp

Issue 1182603004: Subzero: Transform suitable Load/Arith/Store sequences into RMW ops. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8632.cpp
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 1365d54795b70028440533e27dc4943c2e34976e..09d2ef45fa90ca127992db55f32087bc6fe51db0 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -111,6 +111,14 @@ OperandX8632Mem::OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base,
}
}
+InstX8632FakeRMW::InstX8632FakeRMW(Cfg *Func, Operand *Data, Operand *Addr,
+ InstArithmetic::OpKind Op, Variable *Beacon)
+ : InstX8632(Func, InstX8632::FakeRMW, 3, nullptr), Op(Op) {
+ addSource(Data);
+ addSource(Addr);
+ addSource(Beacon);
+}
+
InstX8632AdjustStack::InstX8632AdjustStack(Cfg *Func, SizeT Amount,
Variable *Esp)
: InstX8632(Func, InstX8632::Adjuststack, 1, Esp), Amount(Amount) {
@@ -370,6 +378,19 @@ void InstX8632::dump(const Cfg *Func) const {
Inst::dump(Func);
}
+void InstX8632FakeRMW::dump(const Cfg *Func) const {
+ if (!ALLOW_DUMP)
+ return;
+ Ostream &Str = Func->getContext()->getStrDump();
+ Type Ty = getData()->getType();
+ Str << "rmw " << InstArithmetic::getOpName(getOp()) << " " << Ty << " *";
+ getAddr()->dump(Func);
+ Str << ", ";
+ getData()->dump(Func);
+ Str << ", beacon=";
+ getBeacon()->dump(Func);
+}
+
void InstX8632Label::emit(const Cfg *Func) const {
if (!ALLOW_DUMP)
return;
@@ -589,7 +610,9 @@ void InstX8632::emitTwoAddress(const char *Opcode, const Inst *Inst,
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2);
- Variable *Dest = Inst->getDest();
+ Operand *Dest = Inst->getDest();
+ if (Dest == nullptr)
+ Dest = Inst->getSrc(0);
assert(Dest == Inst->getSrc(0));
Operand *Src1 = Inst->getSrc(1);
Str << "\t" << Opcode << InstX8632::getWidthString(Dest->getType()) << "\t";
@@ -911,6 +934,7 @@ template <> const char *InstX8632Movp::Opcode = "movups";
template <> const char *InstX8632Movq::Opcode = "movq";
// Binary ops
template <> const char *InstX8632Add::Opcode = "add";
+template <> const char *InstX8632AddRMW::Opcode = "add";
template <> const char *InstX8632Addps::Opcode = "addps";
template <> const char *InstX8632Adc::Opcode = "adc";
template <> const char *InstX8632Addss::Opcode = "addss";
@@ -994,6 +1018,9 @@ const X8632::AssemblerX8632::GPREmitterRegOp InstX8632Add::Emitter = {
&X8632::AssemblerX8632::add, &X8632::AssemblerX8632::add,
&X8632::AssemblerX8632::add};
template <>
+const X8632::AssemblerX8632::GPREmitterAddrOp InstX8632AddRMW::Emitter = {
+ &X8632::AssemblerX8632::add, &X8632::AssemblerX8632::add};
+template <>
const X8632::AssemblerX8632::GPREmitterRegOp InstX8632Adc::Emitter = {
&X8632::AssemblerX8632::adc, &X8632::AssemblerX8632::adc,
&X8632::AssemblerX8632::adc};
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698