Fix MC_Equals to handle NODEP MCIDs.
[satcheck.git] / execpoint.h
1 /*      Copyright (c) 2015 Regents of the University of California
2  *
3  *      Author: Brian Demsky <bdemsky@uci.edu>
4  *
5  *      This program is free software; you can redistribute it and/or
6  *      modify it under the terms of the GNU General Public License
7  *      version 2 as published by the Free Software Foundation.
8  */
9
10 #ifndef EXECPOINT_H
11 #define EXECPOINT_H
12 #include "mymemory.h"
13 #include "threads-model.h"
14 #include <stdio.h>
15
16 /** @brief An execution point in a trace. These give an execution
17  *  independent way of numbering steps in a trace.*/
18
19 typedef unsigned int execcount_t;
20 enum ExecPointType {EP_BRANCH, EP_COUNTER, EP_LOOP};
21 enum CompareResult {CR_BEFORE, CR_AFTER, CR_EQUALS, CR_INCOMPARABLE};
22
23 class ExecPoint {
24 public:
25         ExecPoint(int length, thread_id_t thread_id);
26         ExecPoint(ExecPoint * e);
27         ~ExecPoint();
28         void reset();
29         void pop();
30         void push(ExecPointType type, execcount_t value);
31         void incrementTop();
32         int getSize() {return (size>>1);}
33         CompareResult compare(const ExecPoint * ep) const;
34         thread_id_t get_tid() const {return tid;}
35         bool directInLoop();
36         bool inLoop();
37         ExecPointType getType();
38         friend bool ExecPointEquals(ExecPoint *e1, ExecPoint * e2);
39         friend unsigned int ExecPointHash(ExecPoint *e1);
40         void print();
41         void print(int f);
42         MEMALLOC;
43 private:
44         unsigned int length;
45         unsigned int size;
46         execcount_t * pairarray;
47         unsigned int hashvalue;
48         thread_id_t tid;
49 };
50
51 unsigned int ExecPointHash(ExecPoint *e);
52 bool ExecPointEquals(ExecPoint *e1, ExecPoint * e2);
53
54 #endif