Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 //===- subzero/src/IceInstrumentation.cpp - ICE intrumentation framework --===// | |
|
Karl
2016/06/06 22:27:03
Spelling intrumentation?
tlively
2016/06/07 00:43:06
Done.
| |
| 2 // | |
| 3 // The Subzero Code Generator | |
| 4 // | |
| 5 // This file is distributed under the University of Illinois Open Source | |
| 6 // License. See LICENSE.TXT for details. | |
| 7 // | |
| 8 //===----------------------------------------------------------------------===// | |
| 9 /// | |
| 10 /// \file | |
| 11 /// \brief Implements the Ice::Instrumentation class. | |
| 12 /// | |
| 13 /// Subclasses can override particular instrumentation methods to specify how | |
| 14 /// the the target program should be instrumented. | |
| 15 /// | |
| 16 //===----------------------------------------------------------------------===// | |
| 17 | |
| 18 #include "IceInstrumentation.h" | |
| 19 | |
| 20 #include "IceCfg.h" | |
| 21 #include "IceInst.h" | |
| 22 #include "IceTargetLowering.h" | |
| 23 | |
| 24 namespace Ice { | |
| 25 | |
| 26 void Instrumentation::instrumentFunc(Cfg *Func) { | |
| 27 assert(Func); | |
| 28 LoweringContext Context; | |
| 29 for (CfgNode *Node : Func->getNodes()) { | |
| 30 Context.init(Node); | |
| 31 instrumentFuncStart(Context); | |
|
Karl
2016/06/06 22:27:02
Since there is no implementation details, it is ha
tlively
2016/06/07 00:43:06
This call should have been outside the loop. Fixed
| |
| 32 while (!Context.atEnd()) | |
| 33 instrumentInst(Context); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 void Instrumentation::instrumentInst(LoweringContext &Context) { | |
| 38 assert(!Context.atEnd()); | |
| 39 Inst *Instr = iteratorToInst(Context.getCur()); | |
| 40 switch (Instr->getKind()) { | |
| 41 case Inst::Alloca: | |
| 42 instrumentAlloca(Context, llvm::cast<InstAlloca>(Instr)); | |
| 43 break; | |
| 44 case Inst::Arithmetic: | |
| 45 instrumentArithmetic(Context, llvm::cast<InstArithmetic>(Instr)); | |
| 46 break; | |
| 47 case Inst::Br: | |
| 48 instrumentBr(Context, llvm::cast<InstBr>(Instr)); | |
| 49 break; | |
| 50 case Inst::Call: | |
| 51 instrumentCall(Context, llvm::cast<InstCall>(Instr)); | |
| 52 break; | |
| 53 case Inst::Cast: | |
| 54 instrumentCast(Context, llvm::cast<InstCast>(Instr)); | |
| 55 break; | |
| 56 case Inst::ExtractElement: | |
| 57 instrumentExtractElement(Context, llvm::cast<InstExtractElement>(Instr)); | |
| 58 break; | |
| 59 case Inst::Fcmp: | |
| 60 instrumentFcmp(Context, llvm::cast<InstFcmp>(Instr)); | |
| 61 break; | |
| 62 case Inst::Icmp: | |
| 63 instrumentIcmp(Context, llvm::cast<InstIcmp>(Instr)); | |
| 64 break; | |
| 65 case Inst::InsertElement: | |
| 66 instrumentInsertElement(Context, llvm::cast<InstInsertElement>(Instr)); | |
| 67 break; | |
| 68 case Inst::IntrinsicCall: | |
| 69 instrumentIntrinsicCall(Context, llvm::cast<InstIntrinsicCall>(Instr)); | |
| 70 break; | |
| 71 case Inst::Load: | |
| 72 instrumentLoad(Context, llvm::cast<InstLoad>(Instr)); | |
| 73 break; | |
| 74 case Inst::Phi: | |
| 75 instrumentPhi(Context, llvm::cast<InstPhi>(Instr)); | |
| 76 break; | |
| 77 case Inst::Ret: | |
| 78 instrumentRet(Context, llvm::cast<InstRet>(Instr)); | |
| 79 break; | |
| 80 case Inst::Select: | |
| 81 instrumentSelect(Context, llvm::cast<InstSelect>(Instr)); | |
| 82 break; | |
| 83 case Inst::Store: | |
| 84 instrumentStore(Context, llvm::cast<InstStore>(Instr)); | |
| 85 break; | |
| 86 case Inst::Switch: | |
| 87 instrumentSwitch(Context, llvm::cast<InstSwitch>(Instr)); | |
| 88 break; | |
| 89 case Inst::Unreachable: | |
| 90 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr)); | |
| 91 break; | |
| 92 default: | |
|
Roland McGrath
2016/06/06 22:28:45
This will silently ignore any other kinds of instr
tlively
2016/06/07 00:43:05
I added an assert with documentation of why the ot
| |
| 93 break; | |
| 94 } | |
| 95 | |
| 96 Context.advanceCur(); | |
| 97 Context.advanceNext(); | |
| 98 } | |
| 99 | |
| 100 } // end of namespace Ice | |
| OLD | NEW |