Mercurial > projects > ldc
comparison gen/passes/SimplifyDRuntimeCalls.cpp @ 1551:ed0feda76820
DOUT is deprecated, use DEBUG(errs()) instead
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Mon, 27 Jul 2009 11:44:01 +0200 |
parents | 7fcb72d518f6 |
children | f55ca8a1598c |
comparison
equal
deleted
inserted
replaced
1550:c704fea92f80 | 1551:ed0feda76820 |
---|---|
26 #include "llvm/Target/TargetData.h" | 26 #include "llvm/Target/TargetData.h" |
27 #include "llvm/ADT/StringMap.h" | 27 #include "llvm/ADT/StringMap.h" |
28 #include "llvm/ADT/Statistic.h" | 28 #include "llvm/ADT/Statistic.h" |
29 #include "llvm/Support/Compiler.h" | 29 #include "llvm/Support/Compiler.h" |
30 #include "llvm/Support/Debug.h" | 30 #include "llvm/Support/Debug.h" |
31 #include "llvm/Support/raw_ostream.h" | |
31 using namespace llvm; | 32 using namespace llvm; |
32 | 33 |
33 STATISTIC(NumSimplified, "Number of runtime calls simplified"); | 34 STATISTIC(NumSimplified, "Number of runtime calls simplified"); |
34 STATISTIC(NumDeleted, "Number of runtime calls deleted"); | 35 STATISTIC(NumDeleted, "Number of runtime calls deleted"); |
35 | 36 |
377 const char *CalleeName = Callee->getNameStart(); | 378 const char *CalleeName = Callee->getNameStart(); |
378 StringMap<LibCallOptimization*>::iterator OMI = | 379 StringMap<LibCallOptimization*>::iterator OMI = |
379 Optimizations.find(CalleeName, CalleeName+Callee->getNameLen()); | 380 Optimizations.find(CalleeName, CalleeName+Callee->getNameLen()); |
380 if (OMI == Optimizations.end()) continue; | 381 if (OMI == Optimizations.end()) continue; |
381 | 382 |
382 DEBUG(DOUT << "SimplifyDRuntimeCalls inspecting: " << *CI); | 383 DEBUG(errs() << "SimplifyDRuntimeCalls inspecting: " << *CI); |
383 | 384 |
384 // Set the builder to the instruction after the call. | 385 // Set the builder to the instruction after the call. |
385 Builder.SetInsertPoint(BB, I); | 386 Builder.SetInsertPoint(BB, I); |
386 | 387 |
387 // Try to optimize this call. | 388 // Try to optimize this call. |
388 Value *Result = OMI->second->OptimizeCall(CI, Changed, TD, AA, Builder); | 389 Value *Result = OMI->second->OptimizeCall(CI, Changed, TD, AA, Builder); |
389 if (Result == 0) continue; | 390 if (Result == 0) continue; |
390 | 391 |
391 DEBUG(DOUT << "SimplifyDRuntimeCalls simplified: " << *CI; | 392 DEBUG(errs() << "SimplifyDRuntimeCalls simplified: " << *CI; |
392 DOUT << " into: " << *Result << "\n"); | 393 errs() << " into: " << *Result << "\n"); |
393 | 394 |
394 // Something changed! | 395 // Something changed! |
395 Changed = true; | 396 Changed = true; |
396 | 397 |
397 if (Result == CI) { | 398 if (Result == CI) { |