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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceTargetLowering.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.h
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index f45956c771e7078baef680f77f65ae2a1be0c056..9fb0c15e142631014328e903a94c0f803af738c0 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -45,6 +45,21 @@ namespace Ice {
} \
} while (0)
+// UnimplementedLoweringError is similar in style to UnimplementedError. Given
+// a TargetLowering object pointer and an Inst pointer, it adds appropriate
+// FakeDef and FakeUse instructions to try maintain liveness consistency.
+#define UnimplementedLoweringError(Target, Instr) \
+ do { \
+ if ((Target)->Ctx->getFlags().getSkipUnimplemented()) { \
+ (Target)->addFakeDefUses(Instr); \
+ } else { \
+ /* Use llvm_unreachable instead of report_fatal_error, which gives \
+ better stack traces. */ \
+ llvm_unreachable("Not yet implemented"); \
+ abort(); \
+ } \
+ } while (0)
+
/// LoweringContext makes it easy to iterate through non-deleted instructions in
/// a node, and insert new (lowered) instructions at the current point. Along
/// with the instruction list container and associated iterators, it holds the
@@ -373,6 +388,12 @@ protected:
/// before returning.
virtual void postLower() {}
+ /// When the SkipUnimplemented flag is set, addFakeDefUses() gets invoked by
+ /// the UnimplementedLoweringError macro to insert fake uses of all the
+ /// instruction variables and a fake def of the instruction dest, in order to
+ /// preserve integrity of liveness analysis.
+ void addFakeDefUses(const Inst *Instr);
+
/// Find (non-SSA) instructions where the Dest variable appears in some source
/// operand, and set the IsDestRedefined flag. This keeps liveness analysis
/// consistent.
« 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