X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FProfileInfoLoader.cpp;h=732829887e91391587fcccd0c2e95861f3ab3f07;hb=e6be34a53ecbe8c2ff9f0793b13d847e94c0de91;hp=15e9c1338c6612a64d8d47288a5be4c79a0e6273;hpb=2b37d7cf28b1382420b5e4007042feeb66d21ac8;p=oota-llvm.git diff --git a/lib/Analysis/ProfileInfoLoader.cpp b/lib/Analysis/ProfileInfoLoader.cpp index 15e9c1338c6..732829887e9 100644 --- a/lib/Analysis/ProfileInfoLoader.cpp +++ b/lib/Analysis/ProfileInfoLoader.cpp @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -16,10 +16,9 @@ #include "llvm/Analysis/ProfileInfoTypes.h" #include "llvm/Module.h" #include "llvm/InstrTypes.h" +#include "llvm/Support/Streams.h" #include -#include #include - using namespace llvm; // ByteSwap - Byteswap 'Var' if 'Really' is true. @@ -38,7 +37,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read the number of entries... unsigned NumEntries; if (fread(&NumEntries, sizeof(unsigned), 1, F) != 1) { - std::cerr << ToolName << ": data packet truncated!\n"; + cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -49,7 +48,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read in the block of data... if (fread(&TempSpace[0], sizeof(unsigned)*NumEntries, 1, F) != 1) { - std::cerr << ToolName << ": data packet truncated!\n"; + cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -76,7 +75,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, Module &TheModule) : M(TheModule) { FILE *F = fopen(Filename.c_str(), "r"); if (F == 0) { - std::cerr << ToolName << ": Error opening '" << Filename << "': "; + cerr << ToolName << ": Error opening '" << Filename << "': "; perror(0); exit(1); } @@ -94,7 +93,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, case ArgumentInfo: { unsigned ArgLength; if (fread(&ArgLength, sizeof(unsigned), 1, F) != 1) { - std::cerr << ToolName << ": arguments packet truncated!\n"; + cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -105,7 +104,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, if (ArgLength) if (fread(&Chars[0], (ArgLength+3) & ~3, 1, F) != 1) { - std::cerr << ToolName << ": arguments packet truncated!\n"; + cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -130,7 +129,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, break; default: - std::cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; + cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; exit(1); } } @@ -153,11 +152,12 @@ void ProfileInfoLoader::getFunctionCounts(std::vectorgetParent()->front() == BlockCounts[i].first) + if (&BlockCounts[i].first->getParent()->getEntryBlock() == + BlockCounts[i].first) Counts.push_back(std::make_pair(BlockCounts[i].first->getParent(), BlockCounts[i].second)); } else { - std::cerr << "Function counts are not available!\n"; + cerr << "Function counts are not available!\n"; } return; } @@ -165,7 +165,7 @@ void ProfileInfoLoader::getFunctionCounts(std::vectorisExternal()) + if (!I->isDeclaration()) Counts.push_back(std::make_pair(I, FunctionCounts[Counter++])); } @@ -201,8 +201,8 @@ void ProfileInfoLoader::getBlockCounts(std::vector= TI->getNumSuccessors()) { static bool Warned = false; if (!Warned) { - std::cerr << "WARNING: profile info doesn't seem to match" - << " the program!\n"; + cerr << "WARNING: profile info doesn't seem to match" + << " the program!\n"; Warned = true; } } else { @@ -227,7 +227,7 @@ void ProfileInfoLoader::getBlockCounts(std::vector > &Counts) { if (EdgeCounts.empty()) { - std::cerr << "Edge counts not available, and no synthesis " - << "is implemented yet!\n"; + cerr << "Edge counts not available, and no synthesis " + << "is implemented yet!\n"; return; } @@ -269,9 +269,8 @@ void ProfileInfoLoader::getEdgeCounts(std::vector &Trace) { if (BBTrace.empty ()) { - std::cerr << "Basic block trace is not available!\n"; + cerr << "Basic block trace is not available!\n"; return; } - std::cerr << "Basic block trace loading is not implemented yet!\n"; + cerr << "Basic block trace loading is not implemented yet!\n"; } -