Chromium Code Reviews| Index: src/IceInst.h |
| diff --git a/src/IceInst.h b/src/IceInst.h |
| index 360135a133b144c05cfe4013e8ff110cef550192..71db136f5144fd2dedcc45658753c02a7cecb51d 100644 |
| --- a/src/IceInst.h |
| +++ b/src/IceInst.h |
| @@ -21,21 +21,20 @@ |
| #include "IceDefs.h" |
| #include "IceInst.def" |
| #include "IceIntrinsics.h" |
| +#include "IceTargetKinds.def" |
| #include "IceTypes.h" |
| // TODO: The Cfg structure, and instructions in particular, need to be |
| -// validated for things like valid operand types, valid branch |
| -// targets, proper ordering of Phi and non-Phi instructions, etc. |
| -// Most of the validity checking will be done in the bitcode reader. |
| -// We need a list of everything that should be validated, and tests |
| -// for each. |
| +// validated for things like valid operand types, valid branch targets, proper |
| +// ordering of Phi and non-Phi instructions, etc. Most of the validity |
| +// checking will be done in the bitcode reader. We need a list of everything |
| +// that should be validated, and tests for each. |
| namespace Ice { |
| -/// Base instruction class for ICE. Inst has two subclasses: |
| -/// InstHighLevel and InstTarget. High-level ICE instructions inherit |
| -/// from InstHighLevel, and low-level (target-specific) ICE |
| -/// instructions inherit from InstTarget. |
| +/// Base instruction class for ICE. Inst has two subclasses: InstHighLevel and |
| +/// InstTarget. High-level ICE instructions inherit from InstHighLevel, and |
| +/// low-level (target-specific) ICE instructions inherit from InstTarget. |
| class Inst : public llvm::ilist_node<Inst> { |
| Inst() = delete; |
| Inst(const Inst &) = delete; |
| @@ -68,12 +67,13 @@ public: |
| FakeUse, // not part of LLVM/PNaCl bitcode |
| FakeKill, // not part of LLVM/PNaCl bitcode |
| JumpTable, // not part of LLVM/PNaCl bitcode |
| - Target // target-specific low-level ICE |
| - // Anything >= Target is an InstTarget subclass. |
| - // Note that the value-spaces are shared across targets. |
| - // To avoid confusion over the definition of shared values, |
| - // an object specific to one target should never be passed |
| - // to a different target. |
| + // Anything >= Target is an InstTarget subclass. Note that the value-spaces |
| + // are shared across targets. To avoid confusion over the definition of |
| + // shared values, an object specific to one target should never be passed |
| + // to a different target. |
| +#define X(n) Target##n, |
|
John
2015/09/08 15:57:11
If I understand what Jim said, the UB happens not
ascull
2015/09/08 17:29:26
Done.
|
| + TARGETKINDS_INSTS_TABLE |
| +#undef X |
| }; |
| InstKind getKind() const { return Kind; } |
| @@ -107,13 +107,13 @@ public: |
| bool isLastUse(const Operand *Src) const; |
| void spliceLivenessInfo(Inst *OrigInst, Inst *SpliceAssn); |
| - /// Returns a list of out-edges corresponding to a terminator |
| - /// instruction, which is the last instruction of the block. |
| - /// The list must not contain duplicates. |
| + /// Returns a list of out-edges corresponding to a terminator instruction, |
| + /// which is the last instruction of the block. The list must not contain |
| + /// duplicates. |
| virtual NodeList getTerminatorEdges() const { |
| - // All valid terminator instructions override this method. For |
| - // the default implementation, we assert in case some CfgNode |
| - // is constructed without a terminator instruction at the end. |
| + // All valid terminator instructions override this method. For the default |
| + // implementation, we assert in case some CfgNode is constructed without a |
| + // terminator instruction at the end. |
| llvm_unreachable( |
| "getTerminatorEdges() called on a non-terminator instruction"); |
| return NodeList(); |
| @@ -131,19 +131,18 @@ public: |
| virtual bool isSimpleAssign() const { return false; } |
| void livenessLightweight(Cfg *Func, LivenessBV &Live); |
| - /// Calculates liveness for this instruction. Returns true if this |
| - /// instruction is (tentatively) still live and should be retained, |
| - /// and false if this instruction is (tentatively) dead and should be |
| - /// deleted. The decision is tentative until the liveness dataflow |
| - /// algorithm has converged, and then a separate pass permanently |
| - /// deletes dead instructions. |
| + // Calculates liveness for this instruction. Returns true if this |
| + /// instruction is (tentatively) still live and should be retained, and false |
| + /// if this instruction is (tentatively) dead and should be deleted. The |
| + /// decision is tentative until the liveness dataflow algorithm has converged, |
| + /// and then a separate pass permanently deletes dead instructions. |
| bool liveness(InstNumberT InstNumber, LivenessBV &Live, Liveness *Liveness, |
| LiveBeginEndMap *LiveBegin, LiveBeginEndMap *LiveEnd); |
| - /// Get the number of native instructions that this instruction |
| - /// ultimately emits. By default, high-level instructions don't |
| - /// result in any native instructions, and a target-specific |
| - /// instruction results in a single native instruction. |
| + /// Get the number of native instructions that this instruction ultimately |
| + /// emits. By default, high-level instructions don't result in any native |
| + /// instructions, and a target-specific instruction results in a single native |
| + /// instruction. |
| virtual uint32_t getEmitInstCount() const { return 0; } |
| // TODO(stichnot): Change Inst back to abstract once the g++ build |
| // issue is fixed. llvm::ilist<Ice::Inst> doesn't work under g++ |
| @@ -954,12 +953,12 @@ class InstTarget : public Inst { |
| public: |
| uint32_t getEmitInstCount() const override { return 1; } |
| void dump(const Cfg *Func) const override; |
| - static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } |
| + static bool classof(const Inst *Inst) { return Inst->getKind() >= Target0; } |
| protected: |
| InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) |
| : Inst(Func, Kind, MaxSrcs, Dest) { |
| - assert(Kind >= Target); |
| + assert(Kind >= Target0); |
| } |
| }; |