projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add comment.
[oota-llvm.git]
/
lib
/
Analysis
/
ProfileInfoLoader.cpp
diff --git
a/lib/Analysis/ProfileInfoLoader.cpp
b/lib/Analysis/ProfileInfoLoader.cpp
index 15e9c1338c6612a64d8d47288a5be4c79a0e6273..732829887e91391587fcccd0c2e95861f3ab3f07 100644
(file)
--- a/
lib/Analysis/ProfileInfoLoader.cpp
+++ b/
lib/Analysis/ProfileInfoLoader.cpp
@@
-2,8
+2,8
@@
//
// The LLVM Compiler Infrastructure
//
//
// 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/Analysis/ProfileInfoTypes.h"
#include "llvm/Module.h"
#include "llvm/InstrTypes.h"
+#include "llvm/Support/Streams.h"
#include <cstdio>
#include <cstdio>
-#include <iostream>
#include <map>
#include <map>
-
using namespace llvm;
// ByteSwap - Byteswap 'Var' if 'Really' is true.
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) {
// 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);
}
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) {
// 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);
}
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) {
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);
}
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) {
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);
}
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) {
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);
}
perror(0);
exit(1);
}
@@
-130,7
+129,7
@@
ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
break;
default:
break;
default:
-
std::
cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
+ cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
exit(1);
}
}
exit(1);
}
}
@@
-153,11
+152,12
@@
void ProfileInfoLoader::getFunctionCounts(std::vector<std::pair<Function*,
getBlockCounts(BlockCounts);
for (unsigned i = 0, e = BlockCounts.size(); i != e; ++i)
getBlockCounts(BlockCounts);
for (unsigned i = 0, e = BlockCounts.size(); i != e; ++i)
- if (&BlockCounts[i].first->getParent()->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 {
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;
}
}
return;
}
@@
-165,7
+165,7
@@
void ProfileInfoLoader::getFunctionCounts(std::vector<std::pair<Function*,
unsigned Counter = 0;
for (Module::iterator I = M.begin(), E = M.end();
I != E && Counter != FunctionCounts.size(); ++I)
unsigned Counter = 0;
for (Module::iterator I = M.begin(), E = M.end();
I != E && Counter != FunctionCounts.size(); ++I)
- if (!I->is
External
())
+ if (!I->is
Declaration
())
Counts.push_back(std::make_pair(I, FunctionCounts[Counter++]));
}
Counts.push_back(std::make_pair(I, FunctionCounts[Counter++]));
}
@@
-201,8
+201,8
@@
void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
if (SuccNum >= TI->getNumSuccessors()) {
static bool Warned = false;
if (!Warned) {
if (SuccNum >= 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 {
Warned = true;
}
} else {
@@
-227,7
+227,7
@@
void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
}
} else {
}
} else {
-
std::
cerr << "Block counts are not available!\n";
+ cerr << "Block counts are not available!\n";
}
return;
}
}
return;
}
@@
-248,8
+248,8
@@
void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
void ProfileInfoLoader::getEdgeCounts(std::vector<std::pair<Edge,
unsigned> > &Counts) {
if (EdgeCounts.empty()) {
void ProfileInfoLoader::getEdgeCounts(std::vector<std::pair<Edge,
unsigned> > &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;
}
return;
}
@@
-269,9
+269,8
@@
void ProfileInfoLoader::getEdgeCounts(std::vector<std::pair<Edge,
//
void ProfileInfoLoader::getBBTrace(std::vector<BasicBlock *> &Trace) {
if (BBTrace.empty ()) {
//
void ProfileInfoLoader::getBBTrace(std::vector<BasicBlock *> &Trace) {
if (BBTrace.empty ()) {
-
std::
cerr << "Basic block trace is not available!\n";
+ cerr << "Basic block trace is not available!\n";
return;
}
return;
}
-
std::
cerr << "Basic block trace loading is not implemented yet!\n";
+ cerr << "Basic block trace loading is not implemented yet!\n";
}
}
-