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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 1368993004: Subzero: Improve usability of liveness-related tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 RegSetMask RegExclude = RegSet_None; 239 RegSetMask RegExclude = RegSet_None;
240 RegInclude |= RegSet_CallerSave; 240 RegInclude |= RegSet_CallerSave;
241 RegInclude |= RegSet_CalleeSave; 241 RegInclude |= RegSet_CalleeSave;
242 if (hasFramePointer()) 242 if (hasFramePointer())
243 RegExclude |= RegSet_FramePointer; 243 RegExclude |= RegSet_FramePointer;
244 LinearScan.init(Kind); 244 LinearScan.init(Kind);
245 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude); 245 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude);
246 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc()); 246 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc());
247 } 247 }
248 248
249 void TargetLowering::inferTwoAddress() { 249 void TargetLowering::markRedefinitions() {
250 // Find two-address non-SSA instructions where Dest==Src0, and set the 250 // Find (non-SSA) instructions where the Dest variable appears in some source
251 // DestNonKillable flag to keep liveness analysis consistent. 251 // operand, and set the IsDestRedefined flag to keep liveness analysis
252 // consistent.
252 for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) { 253 for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) {
253 if (Inst->isDeleted()) 254 if (Inst->isDeleted())
254 continue; 255 continue;
255 if (Variable *Dest = Inst->getDest()) { 256 Variable *Dest = Inst->getDest();
256 // TODO(stichnot): We may need to consider all source operands, not just 257 if (Dest == nullptr)
257 // the first one, if using 3-address instructions. 258 continue;
258 if (Inst->getSrcSize() > 0 && Inst->getSrc(0) == Dest) 259 FOREACH_VAR_IN_INST(Var, *Inst) {
259 Inst->setDestNonKillable(); 260 if (Var == Dest) {
261 Inst->setDestRedefined();
262 break;
263 }
260 } 264 }
261 } 265 }
262 } 266 }
263 267
264 void TargetLowering::sortVarsByAlignment(VarList &Dest, 268 void TargetLowering::sortVarsByAlignment(VarList &Dest,
265 const VarList &Source) const { 269 const VarList &Source) const {
266 Dest = Source; 270 Dest = Source;
267 // Instead of std::sort, we could do a bucket sort with log2(alignment) as 271 // Instead of std::sort, we could do a bucket sort with log2(alignment) as
268 // the buckets, if performance is an issue. 272 // the buckets, if performance is an issue.
269 std::sort(Dest.begin(), Dest.end(), 273 std::sort(Dest.begin(), Dest.end(),
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (Target == Target_##X) \ 594 if (Target == Target_##X) \
591 return TargetHeader##X::create(Ctx); 595 return TargetHeader##X::create(Ctx);
592 #include "llvm/Config/SZTargets.def" 596 #include "llvm/Config/SZTargets.def"
593 597
594 llvm::report_fatal_error("Unsupported target header lowering"); 598 llvm::report_fatal_error("Unsupported target header lowering");
595 } 599 }
596 600
597 TargetHeaderLowering::~TargetHeaderLowering() = default; 601 TargetHeaderLowering::~TargetHeaderLowering() = default;
598 602
599 } // end of namespace Ice 603 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698