Continued... Show file and line info when possible on internal graph errors.
This commit is contained in:
parent
22939d7473
commit
43694ec87c
|
|
@ -277,6 +277,10 @@ inline void v3errorEndFatal(std::ostringstream& sstr) { V3Error::v3errorEnd(sstr
|
||||||
#define v3fatal(msg) v3warnCodeFatal(V3ErrorCode::EC_FATAL, msg)
|
#define v3fatal(msg) v3warnCodeFatal(V3ErrorCode::EC_FATAL, msg)
|
||||||
// Use this instead of fatal() to mention the source code line.
|
// Use this instead of fatal() to mention the source code line.
|
||||||
#define v3fatalSrc(msg) v3warnCodeFatal(V3ErrorCode::EC_FATALSRC, __FILE__<<":"<<std::dec<<__LINE__<<": "<<msg)
|
#define v3fatalSrc(msg) v3warnCodeFatal(V3ErrorCode::EC_FATALSRC, __FILE__<<":"<<std::dec<<__LINE__<<": "<<msg)
|
||||||
|
// Use this when normal v3fatal is called in static method that overrides fileline.
|
||||||
|
#define v3fatalStatic(msg) \
|
||||||
|
::v3errorEndFatal((V3Error::v3errorPrep(V3ErrorCode::EC_FATAL), \
|
||||||
|
(V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
|
||||||
|
|
||||||
#define UINFO(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
#define UINFO(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
||||||
#define UINFONL(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<stmsg; } }
|
#define UINFONL(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<stmsg; } }
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,10 @@ void V3Graph::clearColors() {
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Dumping
|
// Dumping
|
||||||
|
|
||||||
|
void V3Graph::loopsMessageCb(V3GraphVertex* vertexp) {
|
||||||
|
vertexp->v3fatalSrc("Loops detected in graph: "<<vertexp);
|
||||||
|
}
|
||||||
|
|
||||||
void V3Graph::loopsVertexCb(V3GraphVertex* vertexp) {
|
void V3Graph::loopsVertexCb(V3GraphVertex* vertexp) {
|
||||||
// Needed here as V3GraphVertex<< isn't defined until later in header
|
// Needed here as V3GraphVertex<< isn't defined until later in header
|
||||||
std::cerr<<"-Info-Loop: "<<(void*)(vertexp)<<" "<<vertexp<<endl;
|
std::cerr<<"-Info-Loop: "<<(void*)(vertexp)<<" "<<vertexp<<endl;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
class FileLine;
|
||||||
class V3Graph;
|
class V3Graph;
|
||||||
class V3GraphVertex;
|
class V3GraphVertex;
|
||||||
class V3GraphEdge;
|
class V3GraphEdge;
|
||||||
|
|
@ -171,7 +172,7 @@ public:
|
||||||
static void selfTest();
|
static void selfTest();
|
||||||
|
|
||||||
// CALLBACKS
|
// CALLBACKS
|
||||||
virtual void loopsMessageCb(V3GraphVertex* vertexp) { v3fatalSrc("Loops detected in graph: "<<vertexp); }
|
virtual void loopsMessageCb(V3GraphVertex* vertexp);
|
||||||
virtual void loopsVertexCb(V3GraphVertex* vertexp);
|
virtual void loopsVertexCb(V3GraphVertex* vertexp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -248,10 +249,11 @@ public:
|
||||||
V3GraphEdge* beginp(GraphWay way) const {
|
V3GraphEdge* beginp(GraphWay way) const {
|
||||||
return way.forward() ? outBeginp() : inBeginp(); }
|
return way.forward() ? outBeginp() : inBeginp(); }
|
||||||
// METHODS
|
// METHODS
|
||||||
/// Edges are routed around this vertex to point from "from" directly to "to"
|
/// Error reporting
|
||||||
void rerouteEdges(V3Graph* graphp);
|
|
||||||
void v3errorEnd(std::ostringstream& str) const;
|
void v3errorEnd(std::ostringstream& str) const;
|
||||||
void v3errorEndFatal(std::ostringstream& str) const;
|
void v3errorEndFatal(std::ostringstream& str) const;
|
||||||
|
/// Edges are routed around this vertex to point from "from" directly to "to"
|
||||||
|
void rerouteEdges(V3Graph* graphp);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp);
|
std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp);
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ DfaVertex* DfaGraph::findStart() {
|
||||||
for (V3GraphVertex* vertexp = this->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = this->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
||||||
if (vvertexp->start()) {
|
if (vvertexp->start()) {
|
||||||
if (startp) v3fatalSrc("Multiple start points in NFA graph");
|
if (startp) vertexp->v3fatalSrc("Multiple start points in NFA graph");
|
||||||
startp = vvertexp;
|
startp = vvertexp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v3fatalSrc("Non DfaVertex in DfaGraph");
|
vertexp->v3fatalSrc("Non DfaVertex in DfaGraph");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!startp) v3fatalSrc("No start point in NFA graph");
|
if (!startp) v3fatalSrc("No start point in NFA graph");
|
||||||
|
|
@ -116,7 +116,9 @@ private:
|
||||||
DfaVertex* nfaStatep = static_cast<DfaVertex*>(dfaEdgep->top());
|
DfaVertex* nfaStatep = static_cast<DfaVertex*>(dfaEdgep->top());
|
||||||
hash ^= hashVertex(nfaStatep);
|
hash ^= hashVertex(nfaStatep);
|
||||||
if (debug()) {
|
if (debug()) {
|
||||||
if (nfaStatep->user()==m_step) v3fatalSrc("DFA state points to duplicate NFA state.");
|
if (nfaStatep->user()==m_step) {
|
||||||
|
nfaStatep->v3fatalSrc("DFA state points to duplicate NFA state.");
|
||||||
|
}
|
||||||
nfaStatep->user(m_step);
|
nfaStatep->user(m_step);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +446,7 @@ private:
|
||||||
vertexp->user(1);
|
vertexp->user(1);
|
||||||
} else {
|
} else {
|
||||||
// If ever remove this, need dyn cast below
|
// If ever remove this, need dyn cast below
|
||||||
v3fatalSrc("Non DfaVertex in dfa graph");
|
vertexp->v3fatalSrc("Non DfaVertex in dfa graph");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1239,7 +1239,9 @@ inline void OrderMoveDomScope::ready(OrderVisitor* ovp) {
|
||||||
|
|
||||||
// Mark one vertex as finished, remove from ready list if done
|
// Mark one vertex as finished, remove from ready list if done
|
||||||
inline void OrderMoveDomScope::movedVertex(OrderVisitor* ovp, OrderMoveVertex* vertexp) {
|
inline void OrderMoveDomScope::movedVertex(OrderVisitor* ovp, OrderMoveVertex* vertexp) {
|
||||||
UASSERT(m_onReadyList, "Moving vertex from ready when nothing was on que as ready.");
|
if (!m_onReadyList) {
|
||||||
|
vertexp->v3fatalSrc("Moving vertex from ready when nothing was on que as ready.");
|
||||||
|
}
|
||||||
if (m_readyVertices.empty()) { // Else more work to get to later
|
if (m_readyVertices.empty()) { // Else more work to get to later
|
||||||
m_onReadyList = false;
|
m_onReadyList = false;
|
||||||
m_readyDomScopeE.unlink(ovp->m_pomReadyDomScope, this);
|
m_readyDomScopeE.unlink(ovp->m_pomReadyDomScope, this);
|
||||||
|
|
@ -1306,7 +1308,9 @@ void OrderVisitor::processInputsOutIterate(OrderEitherVertex* vertexp, VertexVec
|
||||||
// First make sure input path is fully recursed
|
// First make sure input path is fully recursed
|
||||||
processInputsInIterate(vertexp, todoVec);
|
processInputsInIterate(vertexp, todoVec);
|
||||||
// Propagate PrimaryIn through simple assignments
|
// Propagate PrimaryIn through simple assignments
|
||||||
if (!vertexp->isFromInput()) v3fatalSrc("processInputsOutIterate only for input marked vertexes");
|
if (!vertexp->isFromInput()) {
|
||||||
|
vertexp->v3fatalSrc("processInputsOutIterate only for input marked vertexes");
|
||||||
|
}
|
||||||
vertexp->user(3); // out-edges processed
|
vertexp->user(3); // out-edges processed
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -1653,7 +1657,9 @@ void OrderVisitor::processMoveDoneOne(OrderMoveVertex* vertexp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OrderVisitor::processMoveOne(OrderMoveVertex* vertexp, OrderMoveDomScope* domScopep, int level) {
|
void OrderVisitor::processMoveOne(OrderMoveVertex* vertexp, OrderMoveDomScope* domScopep, int level) {
|
||||||
UASSERT(vertexp->domScopep() == domScopep, "Domain mismatch; list misbuilt?");
|
if (vertexp->domScopep() != domScopep) {
|
||||||
|
vertexp->v3fatalSrc("Domain mismatch; list misbuilt?");
|
||||||
|
}
|
||||||
const OrderLogicVertex* lvertexp = vertexp->logicp();
|
const OrderLogicVertex* lvertexp = vertexp->logicp();
|
||||||
const AstScope* scopep = lvertexp->scopep();
|
const AstScope* scopep = lvertexp->scopep();
|
||||||
UINFO(5," POSmove l"<<std::setw(3)<<level<<" d="<<(void*)(lvertexp->domainp())
|
UINFO(5," POSmove l"<<std::setw(3)<<level<<" d="<<(void*)(lvertexp->domainp())
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,11 @@ public:
|
||||||
// nodes.
|
// nodes.
|
||||||
PendingEdgeSet pendingEdges(cmp);
|
PendingEdgeSet pendingEdges(cmp);
|
||||||
|
|
||||||
vluint32_t vert_ct = 0;
|
vluint32_t vertCount = 0;
|
||||||
for (V3GraphVertex* vxp = verticesBeginp();
|
for (V3GraphVertex* vxp = verticesBeginp();
|
||||||
vxp; vxp = vxp->verticesNextp()) {
|
vxp; vxp = vxp->verticesNextp()) {
|
||||||
mstp->addVertex(castVertexp(vxp)->key());
|
mstp->addVertex(castVertexp(vxp)->key());
|
||||||
vert_ct++;
|
vertCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose an arbitrary start vertex and visit it;
|
// Choose an arbitrary start vertex and visit it;
|
||||||
|
|
@ -225,8 +225,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UASSERT(edges_made + 1 == vert_ct, "Algorithm failed");
|
UASSERT(edges_made + 1 == vertCount, "Algorithm failed");
|
||||||
UASSERT(visited_set.size() == vert_ct, "Algorithm failed");
|
UASSERT(visited_set.size() == vertCount, "Algorithm failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate *outp with a minimal perfect matching of *this.
|
// Populate *outp with a minimal perfect matching of *this.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue