llvm.org GIT mirror llvm / e50fb9a
Update doc to reflect changes I am about to install to fix PR 888. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36631 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 13 years ago
1 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
262262 time.

263263
264264

                  
                
265 static const int ID;
266 Hello() : FunctionPass((intptr_t)&ID) {}
267

268
269

This declares pass identifier used by LLVM to identify pass. This allows LLVM to

270 avoid using expensive C++ runtime information.

271
272

                  
                
265273 virtual bool runOnFunction(Function &F) {
266274 llvm::cerr << "Hello: " << F.getName() << "\n";
267275 return false;
276284 function.

277285
278286

                  
                
287 const int Hello::ID = 0;
288
289
290

We initialize pass ID here. LLVM uses ID's address to identify pass so

291 initialization value is not important.

292
293

                  
                
279294 RegisterPass<Hello> X("hello", "Hello World Pass");
280295 } // end of anonymous namespace
281296
294309
295310 namespace {
296311 struct Hello : public FunctionPass {
312
313 static const int ID;
314 Hello() : FunctionPass((intptr_t)&ID) {}
315
297316 virtual bool runOnFunction(Function &F) {
298317 llvm::cerr << "Hello: " << F.getName() << "\n";
299318 return false;