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

Side by Side Diff: src/IceInstrumentation.cpp

Issue 2086593002: Inserted local redzones. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 namespace Ice { 24 namespace Ice {
25 25
26 // Iterate through the instructions in the given CFG and instrument each one. 26 // Iterate through the instructions in the given CFG and instrument each one.
27 // Also instrument the beginning of the function. 27 // Also instrument the beginning of the function.
28 void Instrumentation::instrumentFunc(Cfg *Func) { 28 void Instrumentation::instrumentFunc(Cfg *Func) {
29 assert(Func); 29 assert(Func);
30 assert(!Func->getNodes().empty()); 30 assert(!Func->getNodes().empty());
31 31
32 // TODO(tlively): More selectively instrument functions so that shadow memory 32 // TODO(tlively): More selectively instrument functions so that shadow memory
33 // represents user accessibility more and library accessibility less. 33 // represents user accessibility more and library accessibility less.
34 bool DidInstrumentStart = false;
34 LoweringContext Context; 35 LoweringContext Context;
35 Context.init(Func->getNodes().front()); 36 Context.init(Func->getNodes().front());
36 instrumentFuncStart(Context);
37 for (CfgNode *Node : Func->getNodes()) { 37 for (CfgNode *Node : Func->getNodes()) {
38 Context.init(Node); 38 Context.init(Node);
39 while (!Context.atEnd()) { 39 while (!Context.atEnd()) {
40 if (!DidInstrumentStart) {
41 instrumentFuncStart(Context);
42 DidInstrumentStart = true;
43 }
40 instrumentInst(Context); 44 instrumentInst(Context);
41 // go to next undeleted instruction 45 // go to next undeleted instruction
42 Context.advanceCur(); 46 Context.advanceCur();
43 Context.advanceNext(); 47 Context.advanceNext();
44 } 48 }
45 } 49 }
46 50
47 std::string FuncName = Func->getFunctionName().toStringOrEmpty(); 51 std::string FuncName = Func->getFunctionName().toStringOrEmpty();
48 if (FuncName == "_start") 52 if (FuncName == "_start")
49 instrumentStart(Func); 53 instrumentStart(Func);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr)); 109 instrumentUnreachable(Context, llvm::cast<InstUnreachable>(Instr));
106 break; 110 break;
107 default: 111 default:
108 // Only instrument high-level ICE instructions 112 // Only instrument high-level ICE instructions
109 assert(false && "Instrumentation encountered an unexpected instruction"); 113 assert(false && "Instrumentation encountered an unexpected instruction");
110 break; 114 break;
111 } 115 }
112 } 116 }
113 117
114 } // end of namespace Ice 118 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698