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

Side by Side Diff: src/IceTargetLowering.h

Issue 1591893002: Subzero: Improve the usability of UnimplementedError during lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | src/IceTargetLowering.cpp » ('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.h - Lowering interface -----*- C++ -*-===// 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===//
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 27 matching lines...) Expand all
38 #define UnimplementedError(Flags) \ 38 #define UnimplementedError(Flags) \
39 do { \ 39 do { \
40 if (!static_cast<const ClFlags &>(Flags).getSkipUnimplemented()) { \ 40 if (!static_cast<const ClFlags &>(Flags).getSkipUnimplemented()) { \
41 /* Use llvm_unreachable instead of report_fatal_error, which gives \ 41 /* Use llvm_unreachable instead of report_fatal_error, which gives \
42 better stack traces. */ \ 42 better stack traces. */ \
43 llvm_unreachable("Not yet implemented"); \ 43 llvm_unreachable("Not yet implemented"); \
44 abort(); \ 44 abort(); \
45 } \ 45 } \
46 } while (0) 46 } while (0)
47 47
48 // UnimplementedLoweringError is similar in style to UnimplementedError. Given
49 // a TargetLowering object pointer and an Inst pointer, it adds appropriate
50 // FakeDef and FakeUse instructions to try maintain liveness consistency.
51 #define UnimplementedLoweringError(Target, Instr) \
52 do { \
53 if ((Target)->Ctx->getFlags().getSkipUnimplemented()) { \
54 (Target)->addFakeDefUses(Instr); \
55 } else { \
56 /* Use llvm_unreachable instead of report_fatal_error, which gives \
57 better stack traces. */ \
58 llvm_unreachable("Not yet implemented"); \
59 abort(); \
60 } \
61 } while (0)
62
48 /// LoweringContext makes it easy to iterate through non-deleted instructions in 63 /// LoweringContext makes it easy to iterate through non-deleted instructions in
49 /// a node, and insert new (lowered) instructions at the current point. Along 64 /// a node, and insert new (lowered) instructions at the current point. Along
50 /// with the instruction list container and associated iterators, it holds the 65 /// with the instruction list container and associated iterators, it holds the
51 /// current node, which is needed when inserting new instructions in order to 66 /// current node, which is needed when inserting new instructions in order to
52 /// track whether variables are used as single-block or multi-block. 67 /// track whether variables are used as single-block or multi-block.
53 class LoweringContext { 68 class LoweringContext {
54 LoweringContext(const LoweringContext &) = delete; 69 LoweringContext(const LoweringContext &) = delete;
55 LoweringContext &operator=(const LoweringContext &) = delete; 70 LoweringContext &operator=(const LoweringContext &) = delete;
56 71
57 public: 72 public:
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 381
367 virtual void doAddressOptLoad() {} 382 virtual void doAddressOptLoad() {}
368 virtual void doAddressOptStore() {} 383 virtual void doAddressOptStore() {}
369 virtual void doMockBoundsCheck(Operand *) {} 384 virtual void doMockBoundsCheck(Operand *) {}
370 virtual void randomlyInsertNop(float Probability, 385 virtual void randomlyInsertNop(float Probability,
371 RandomNumberGenerator &RNG) = 0; 386 RandomNumberGenerator &RNG) = 0;
372 /// This gives the target an opportunity to post-process the lowered expansion 387 /// This gives the target an opportunity to post-process the lowered expansion
373 /// before returning. 388 /// before returning.
374 virtual void postLower() {} 389 virtual void postLower() {}
375 390
391 /// When the SkipUnimplemented flag is set, addFakeDefUses() gets invoked by
392 /// the UnimplementedLoweringError macro to insert fake uses of all the
393 /// instruction variables and a fake def of the instruction dest, in order to
394 /// preserve integrity of liveness analysis.
395 void addFakeDefUses(const Inst *Instr);
396
376 /// Find (non-SSA) instructions where the Dest variable appears in some source 397 /// Find (non-SSA) instructions where the Dest variable appears in some source
377 /// operand, and set the IsDestRedefined flag. This keeps liveness analysis 398 /// operand, and set the IsDestRedefined flag. This keeps liveness analysis
378 /// consistent. 399 /// consistent.
379 void markRedefinitions(); 400 void markRedefinitions();
380 401
381 /// Make a pass over the Cfg to determine which variables need stack slots and 402 /// Make a pass over the Cfg to determine which variables need stack slots and
382 /// place them in a sorted list (SortedSpilledVariables). Among those, vars, 403 /// place them in a sorted list (SortedSpilledVariables). Among those, vars,
383 /// classify the spill variables as local to the basic block vs global 404 /// classify the spill variables as local to the basic block vs global
384 /// (multi-block) in order to compute the parameters GlobalsSize and 405 /// (multi-block) in order to compute the parameters GlobalsSize and
385 /// SpillAreaSizeBytes (represents locals or general vars if the coalescing of 406 /// SpillAreaSizeBytes (represents locals or general vars if the coalescing of
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 virtual void lower() {} 549 virtual void lower() {}
529 550
530 protected: 551 protected:
531 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} 552 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {}
532 GlobalContext *Ctx; 553 GlobalContext *Ctx;
533 }; 554 };
534 555
535 } // end of namespace Ice 556 } // end of namespace Ice
536 557
537 #endif // SUBZERO_SRC_ICETARGETLOWERING_H 558 #endif // SUBZERO_SRC_ICETARGETLOWERING_H
OLDNEW
« no previous file with comments | « no previous file | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698