forked from OSchip/llvm-project
parent
723928c7dc
commit
cec1c2486a
|
@ -135,7 +135,7 @@ namespace {
|
||||||
GCOVOptions Options;
|
GCOVOptions Options;
|
||||||
|
|
||||||
// Reversed, NUL-terminated copy of Options.Version.
|
// Reversed, NUL-terminated copy of Options.Version.
|
||||||
char ReversedVersion[5];
|
char ReversedVersion[5];
|
||||||
// Checksum, produced by hash of EdgeDestinations
|
// Checksum, produced by hash of EdgeDestinations
|
||||||
SmallVector<uint32_t, 4> FileChecksums;
|
SmallVector<uint32_t, 4> FileChecksums;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ namespace {
|
||||||
write(Lines[i]);
|
write(Lines[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GCOVLines(StringRef F, raw_ostream *os)
|
GCOVLines(StringRef F, raw_ostream *os)
|
||||||
: Filename(F) {
|
: Filename(F) {
|
||||||
this->os = os;
|
this->os = os;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ namespace {
|
||||||
});
|
});
|
||||||
for (SmallVectorImpl<StringMapEntry<GCOVLines *> *>::iterator
|
for (SmallVectorImpl<StringMapEntry<GCOVLines *> *>::iterator
|
||||||
I = SortedLinesByFile.begin(), E = SortedLinesByFile.end();
|
I = SortedLinesByFile.begin(), E = SortedLinesByFile.end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
(*I)->getValue()->writeOut();
|
(*I)->getValue()->writeOut();
|
||||||
write(0);
|
write(0);
|
||||||
write(0);
|
write(0);
|
||||||
|
@ -535,7 +535,7 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||||
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
||||||
if (!CU_Nodes) return false;
|
if (!CU_Nodes) return false;
|
||||||
|
|
||||||
bool Result = false;
|
bool Result = false;
|
||||||
bool InsertIndCounterIncrCode = false;
|
bool InsertIndCounterIncrCode = false;
|
||||||
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
||||||
DICompileUnit CU(CU_Nodes->getOperand(i));
|
DICompileUnit CU(CU_Nodes->getOperand(i));
|
||||||
|
@ -558,7 +558,7 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||||
else
|
else
|
||||||
Edges += TI->getNumSuccessors();
|
Edges += TI->getNumSuccessors();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayType *CounterTy =
|
ArrayType *CounterTy =
|
||||||
ArrayType::get(Type::getInt64Ty(*Ctx), Edges);
|
ArrayType::get(Type::getInt64Ty(*Ctx), Edges);
|
||||||
GlobalVariable *Counters =
|
GlobalVariable *Counters =
|
||||||
|
@ -567,10 +567,10 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||||
Constant::getNullValue(CounterTy),
|
Constant::getNullValue(CounterTy),
|
||||||
"__llvm_gcov_ctr");
|
"__llvm_gcov_ctr");
|
||||||
CountersBySP.push_back(std::make_pair(Counters, (MDNode*)SP));
|
CountersBySP.push_back(std::make_pair(Counters, (MDNode*)SP));
|
||||||
|
|
||||||
UniqueVector<BasicBlock *> ComplexEdgePreds;
|
UniqueVector<BasicBlock *> ComplexEdgePreds;
|
||||||
UniqueVector<BasicBlock *> ComplexEdgeSuccs;
|
UniqueVector<BasicBlock *> ComplexEdgeSuccs;
|
||||||
|
|
||||||
unsigned Edge = 0;
|
unsigned Edge = 0;
|
||||||
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
||||||
TerminatorInst *TI = BB->getTerminator();
|
TerminatorInst *TI = BB->getTerminator();
|
||||||
|
@ -604,13 +604,13 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||||
Edge += Successors;
|
Edge += Successors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ComplexEdgePreds.empty()) {
|
if (!ComplexEdgePreds.empty()) {
|
||||||
GlobalVariable *EdgeTable =
|
GlobalVariable *EdgeTable =
|
||||||
buildEdgeLookupTable(F, Counters,
|
buildEdgeLookupTable(F, Counters,
|
||||||
ComplexEdgePreds, ComplexEdgeSuccs);
|
ComplexEdgePreds, ComplexEdgeSuccs);
|
||||||
GlobalVariable *EdgeState = getEdgeStateValue();
|
GlobalVariable *EdgeState = getEdgeStateValue();
|
||||||
|
|
||||||
for (int i = 0, e = ComplexEdgePreds.size(); i != e; ++i) {
|
for (int i = 0, e = ComplexEdgePreds.size(); i != e; ++i) {
|
||||||
IRBuilder<> Builder(ComplexEdgePreds[i + 1]->getFirstInsertionPt());
|
IRBuilder<> Builder(ComplexEdgePreds[i + 1]->getFirstInsertionPt());
|
||||||
Builder.CreateStore(Builder.getInt32(i), EdgeState);
|
Builder.CreateStore(Builder.getInt32(i), EdgeState);
|
||||||
|
|
Loading…
Reference in New Issue