Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H | 23 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H |
| 24 #define SUBZERO_SRC_ICETARGETLOWERING_H | 24 #define SUBZERO_SRC_ICETARGETLOWERING_H |
| 25 | 25 |
| 26 #include "IceCfgNode.h" | 26 #include "IceCfgNode.h" |
| 27 #include "IceDefs.h" | 27 #include "IceDefs.h" |
| 28 #include "IceInst.h" // for the names of the Inst subtypes | 28 #include "IceInst.h" // for the names of the Inst subtypes |
| 29 #include "IceOperand.h" | 29 #include "IceOperand.h" |
| 30 #include "IceTypes.h" | 30 #include "IceTypes.h" |
| 31 | 31 |
| 32 #include "llvm/Support/raw_ostream.h" | |
| 33 | |
| 32 #include <utility> | 34 #include <utility> |
| 33 | 35 |
| 34 namespace Ice { | 36 namespace Ice { |
| 35 | 37 |
| 36 // UnimplementedError is defined as a macro so that we can get actual line | 38 // UnimplementedError is defined as a macro so that we can get actual line |
| 37 // numbers. | 39 // numbers. |
| 38 #define UnimplementedError(Flags) \ | 40 #define UnimplementedError(Flags) \ |
| 39 do { \ | 41 do { \ |
| 40 if (!static_cast<const ClFlags &>(Flags).getSkipUnimplemented()) { \ | 42 if (!static_cast<const ClFlags &>(Flags).getSkipUnimplemented()) { \ |
| 41 /* Use llvm_unreachable instead of report_fatal_error, which gives \ | 43 /* Use llvm_unreachable instead of report_fatal_error, which gives \ |
| 42 better stack traces. */ \ | 44 better stack traces. */ \ |
| 43 llvm_unreachable("Not yet implemented"); \ | 45 llvm_unreachable("Not yet implemented"); \ |
| 44 abort(); \ | 46 abort(); \ |
| 45 } \ | 47 } \ |
| 46 } while (0) | 48 } while (0) |
| 47 | 49 |
| 48 // UnimplementedLoweringError is similar in style to UnimplementedError. Given | 50 // UnimplementedLoweringError is similar in style to UnimplementedError. Given |
| 49 // a TargetLowering object pointer and an Inst pointer, it adds appropriate | 51 // a TargetLowering object pointer and an Inst pointer, it adds appropriate |
| 50 // FakeDef and FakeUse instructions to try maintain liveness consistency. | 52 // FakeDef and FakeUse instructions to try maintain liveness consistency. |
| 51 #define UnimplementedLoweringError(Target, Instr) \ | 53 #define UnimplementedLoweringError(Target, Instr) \ |
| 52 do { \ | 54 do { \ |
| 53 if ((Target)->Ctx->getFlags().getSkipUnimplemented()) { \ | 55 if ((Target)->Ctx->getFlags().getSkipUnimplemented()) { \ |
| 54 (Target)->addFakeDefUses(Instr); \ | 56 (Target)->addFakeDefUses(Instr); \ |
| 55 } else { \ | 57 } else { \ |
| 58 std::string Buffer; \ | |
| 59 llvm::raw_string_ostream StrBuf(Buffer); \ | |
| 60 StrBuf << "Not yet implemented: " << Instr->getInstName(); \ | |
| 56 /* Use llvm_unreachable instead of report_fatal_error, which gives \ | 61 /* Use llvm_unreachable instead of report_fatal_error, which gives \ |
| 57 better stack traces. */ \ | 62 better stack traces. */ \ |
| 58 llvm_unreachable("Not yet implemented"); \ | 63 llvm_unreachable(StrBuf.str().c_str()); \ |
|
John
2016/01/26 19:07:17
just do
llvm_unreachable("Not yet implemented: "
Eric Holk
2016/01/26 22:49:24
Ok.
| |
| 59 abort(); \ | 64 abort(); \ |
| 60 } \ | 65 } \ |
| 61 } while (0) | 66 } while (0) |
| 62 | 67 |
| 63 /// LoweringContext makes it easy to iterate through non-deleted instructions in | 68 /// LoweringContext makes it easy to iterate through non-deleted instructions in |
| 64 /// a node, and insert new (lowered) instructions at the current point. Along | 69 /// a node, and insert new (lowered) instructions at the current point. Along |
| 65 /// with the instruction list container and associated iterators, it holds the | 70 /// with the instruction list container and associated iterators, it holds the |
| 66 /// current node, which is needed when inserting new instructions in order to | 71 /// current node, which is needed when inserting new instructions in order to |
| 67 /// track whether variables are used as single-block or multi-block. | 72 /// track whether variables are used as single-block or multi-block. |
| 68 class LoweringContext { | 73 class LoweringContext { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 virtual void lower() {} | 565 virtual void lower() {} |
| 561 | 566 |
| 562 protected: | 567 protected: |
| 563 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 568 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 564 GlobalContext *Ctx; | 569 GlobalContext *Ctx; |
| 565 }; | 570 }; |
| 566 | 571 |
| 567 } // end of namespace Ice | 572 } // end of namespace Ice |
| 568 | 573 |
| 569 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 574 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |