 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| Index: src/IceInst.cpp | 
| diff --git a/src/IceInst.cpp b/src/IceInst.cpp | 
| index de082bbb111e67d2f559f495d3c97656c40f8463..30d50662c165c9a2322c3978c3f2721a5c782459 100644 | 
| --- a/src/IceInst.cpp | 
| +++ b/src/IceInst.cpp | 
| @@ -422,9 +422,16 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, | 
| } | 
| InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr) | 
| - : InstHighLevel(Func, Inst::Store, 2, nullptr) { | 
| + : InstHighLevel(Func, Inst::Store, 3, nullptr) { | 
| addSource(Data); | 
| addSource(Addr); | 
| + // The 3rd operand is a dummy placeholder for the RMW beacon. | 
| + addSource(Data); | 
| 
jvoung (off chromium)
2015/06/16 17:59:21
Would it be safer to have nullptr as the dummy? Th
 
Jim Stichnoth
2015/06/17 00:15:40
There's a strong assumption that source operands a
 | 
| +} | 
| + | 
| +void InstStore::setRmwBeacon(Variable *Beacon) { | 
| + Dest = llvm::dyn_cast<Variable>(getData()); | 
| 
jvoung (off chromium)
2015/06/16 17:59:21
is this okay if Data isn't a variable when setting
 
Jim Stichnoth
2015/06/17 00:15:40
Yes - the RMW optimization should only be calling
 | 
| + Srcs[2] = Beacon; | 
| } | 
| InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, | 
| @@ -747,11 +754,18 @@ void InstStore::dump(const Cfg *Func) const { | 
| return; | 
| Ostream &Str = Func->getContext()->getStrDump(); | 
| Type Ty = getData()->getType(); | 
| + dumpDest(Func); | 
| + if (Dest) | 
| + Str << " = "; | 
| Str << "store " << Ty << " "; | 
| getData()->dump(Func); | 
| Str << ", " << Ty << "* "; | 
| getAddr()->dump(Func); | 
| Str << ", align " << typeAlignInBytes(Ty); | 
| + if (getRmwBeacon()) { | 
| + Str << ", beacon "; | 
| + getRmwBeacon()->dump(Func); | 
| + } | 
| } | 
| void InstSwitch::dump(const Cfg *Func) const { |