OLD | NEW |
1 //===- subzero/src/IceInstrumentation.cpp - ICE instrumentation framework -===// | 1 //===- subzero/src/IceInstrumentation.cpp - ICE instrumentation framework -===// |
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 23 matching lines...) Expand all Loading... |
34 instrumentFuncStart(Context); | 34 instrumentFuncStart(Context); |
35 for (CfgNode *Node : Func->getNodes()) { | 35 for (CfgNode *Node : Func->getNodes()) { |
36 Context.init(Node); | 36 Context.init(Node); |
37 while (!Context.atEnd()) { | 37 while (!Context.atEnd()) { |
38 instrumentInst(Context); | 38 instrumentInst(Context); |
39 // go to next undeleted instruction | 39 // go to next undeleted instruction |
40 Context.advanceCur(); | 40 Context.advanceCur(); |
41 Context.advanceNext(); | 41 Context.advanceNext(); |
42 } | 42 } |
43 } | 43 } |
| 44 |
| 45 if (Func->getFunctionName().toStringOrEmpty() == "_start") |
| 46 instrumentStart(Func); |
44 } | 47 } |
45 | 48 |
46 void Instrumentation::instrumentInst(LoweringContext &Context) { | 49 void Instrumentation::instrumentInst(LoweringContext &Context) { |
47 assert(!Context.atEnd()); | 50 assert(!Context.atEnd()); |
48 Inst *Instr = iteratorToInst(Context.getCur()); | 51 Inst *Instr = iteratorToInst(Context.getCur()); |
49 switch (Instr->getKind()) { | 52 switch (Instr->getKind()) { |
50 case Inst::Alloca: | 53 case Inst::Alloca: |
51 instrumentAlloca(Context, llvm::cast<InstAlloca>(Instr)); | 54 instrumentAlloca(Context, llvm::cast<InstAlloca>(Instr)); |
52 break; | 55 break; |
53 case Inst::Arithmetic: | 56 case Inst::Arithmetic: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr)); | 102 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr)); |
100 break; | 103 break; |
101 default: | 104 default: |
102 // Only instrument high-level ICE instructions | 105 // Only instrument high-level ICE instructions |
103 assert(false && "Instrumentation encountered an unexpected instruction"); | 106 assert(false && "Instrumentation encountered an unexpected instruction"); |
104 break; | 107 break; |
105 } | 108 } |
106 } | 109 } |
107 | 110 |
108 } // end of namespace Ice | 111 } // end of namespace Ice |
OLD | NEW |