Hash -> size_t

This commit is contained in:
James Cherry 2019-08-08 14:13:02 -07:00
parent e16696c347
commit 30a5abebc6
27 changed files with 103 additions and 127 deletions

View File

@ -38,12 +38,10 @@ if(NOT CMAKE_BUILD_TYPE)
endif() endif()
# Compiler specific options. # Compiler specific options.
if (CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang) # Note -Wno-deprecated-register is to suppress bison errors.
set(STA_COMPILE_OPTIONS -Wall -Wcast-qual -Wunused-parameter -Wredundant-decls -Wno-deprecated-register) if ((CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang)
endif() OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
set(STA_COMPILE_OPTIONS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls -Wformat-security -Wno-deprecated-register)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(STA_COMPILE_OPTIONS -Wall -Wcast-qual -Wunused-parameter -Wredundant-decls)
endif() endif()
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}") message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")

View File

@ -46,10 +46,7 @@ staMain(Sta *sta,
Sta::setSta(sta); Sta::setSta(sta);
sta->makeComponents(); sta->makeComponents();
int thread_count = 1; int thread_count = parseThreadsArg(argc, argv);
bool threads_exists = false;
parseThreadsArg(argc, argv, thread_count, threads_exists);
if (threads_exists)
sta->setThreadCount(thread_count); sta->setThreadCount(thread_count);
staSetupAppInit(argc, argv, swig_init, tcl_inits); staSetupAppInit(argc, argv, swig_init, tcl_inits);
@ -58,25 +55,20 @@ staMain(Sta *sta,
Tcl_Main(1, argv, staTclAppInit); Tcl_Main(1, argv, staTclAppInit);
} }
void int
parseThreadsArg(int argc, parseThreadsArg(int &argc,
char **argv, char *argv[])
int &thread_count,
bool &exists)
{ {
char *thread_arg = findCmdLineKey(argc, argv, "-threads"); char *thread_arg = findCmdLineKey(argc, argv, "-threads");
if (thread_arg) { if (thread_arg) {
if (stringEqual(thread_arg, "max")) { if (stringEqual(thread_arg, "max"))
thread_count = processorCount(); return processorCount();
exists = true; else if (isDigits(thread_arg))
} return atoi(thread_arg);
else if (isDigits(thread_arg)) {
thread_count = atoi(thread_arg);
exists = true;
}
else else
fprintf(stderr,"Warning: -threads must be max or a positive integer.\n"); fprintf(stderr,"Warning: -threads must be max or a positive integer.\n");
} }
return 1;
} }
// Set globals to pass to staTclAppInit. // Set globals to pass to staTclAppInit.

View File

@ -63,17 +63,9 @@ findCmdLineKey(int &argc,
void void
showUsage(const char *prog); showUsage(const char *prog);
void int
parseThreadsArg(int argc, parseThreadsArg(int &argc,
char **argv, char *argv[]);
int &threads,
bool &exists);
void
parseCmdsArg(int argc,
char **argv,
bool &native_cmds,
bool &compatibility_cmds);
void void
sourceTclFile(const char *filename, sourceTclFile(const char *filename,
bool echo, bool echo,

View File

@ -699,7 +699,7 @@ Graph::makeArcDelayPools(ArcIndex arc_count,
} }
// Leave some room for edits. // Leave some room for edits.
unsigned annot_size = arc_count * 1.2; int annot_size = arc_count * 1.2;
arc_delay_annotated_.resize(annot_size * ap_count); arc_delay_annotated_.resize(annot_size * ap_count);
} }
} }
@ -731,9 +731,9 @@ Graph::makeEdgeArcDelays(Edge *edge)
} }
edge->setArcDelays(arc_index); edge->setArcDelays(arc_index);
// Make sure there is room for delay_annotated flags. // Make sure there is room for delay_annotated flags.
unsigned max_annot_index = (arc_index + arc_count) * ap_count_; size_t max_annot_index = (arc_index + arc_count) * ap_count_;
if (max_annot_index >= arc_delay_annotated_.size()) { if (max_annot_index >= arc_delay_annotated_.size()) {
unsigned size = max_annot_index * 1.2; size_t size = max_annot_index * 1.2;
arc_delay_annotated_.resize(size); arc_delay_annotated_.resize(size);
} }
removeDelayAnnotated(edge); removeDelayAnnotated(edge);
@ -817,7 +817,7 @@ Graph::arcDelayAnnotated(Edge *edge,
DcalcAPIndex ap_index) const DcalcAPIndex ap_index) const
{ {
if (arc_delay_annotated_.size()) { if (arc_delay_annotated_.size()) {
unsigned index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index; size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
if (index >= arc_delay_annotated_.size()) if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded"); internalError("arc_delay_annotated array bounds exceeded");
return arc_delay_annotated_[index]; return arc_delay_annotated_[index];
@ -832,7 +832,7 @@ Graph::setArcDelayAnnotated(Edge *edge,
DcalcAPIndex ap_index, DcalcAPIndex ap_index,
bool annotated) bool annotated)
{ {
unsigned index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index; size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
if (index >= arc_delay_annotated_.size()) if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded"); internalError("arc_delay_annotated array bounds exceeded");
arc_delay_annotated_[index] = annotated; arc_delay_annotated_[index] = annotated;
@ -843,7 +843,7 @@ Graph::wireDelayAnnotated(Edge *edge,
const TransRiseFall *tr, const TransRiseFall *tr,
DcalcAPIndex ap_index) const DcalcAPIndex ap_index) const
{ {
unsigned index = (edge->arcDelays() + TimingArcSet::wireArcIndex(tr)) * ap_count_ size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(tr)) * ap_count_
+ ap_index; + ap_index;
if (index >= arc_delay_annotated_.size()) if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded"); internalError("arc_delay_annotated array bounds exceeded");
@ -856,7 +856,7 @@ Graph::setWireDelayAnnotated(Edge *edge,
DcalcAPIndex ap_index, DcalcAPIndex ap_index,
bool annotated) bool annotated)
{ {
unsigned index = (edge->arcDelays() + TimingArcSet::wireArcIndex(tr)) * ap_count_ size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(tr)) * ap_count_
+ ap_index; + ap_index;
if (index >= arc_delay_annotated_.size()) if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded"); internalError("arc_delay_annotated array bounds exceeded");

View File

@ -323,7 +323,7 @@ CycleAcctingLess::operator()(const CycleAccting *acct1,
&& acct1->target()->index() < acct2->target()->index()); && acct1->target()->index() < acct2->target()->index());
} }
Hash size_t
CycleAcctingHash::operator()(const CycleAccting *acct) const CycleAcctingHash::operator()(const CycleAccting *acct) const
{ {
return hashSum(acct->src()->index(), acct->target()->index()); return hashSum(acct->src()->index(), acct->target()->index());

View File

@ -91,7 +91,7 @@ public:
class CycleAcctingHash class CycleAcctingHash
{ {
public: public:
Hash operator()(const CycleAccting *acct) const; size_t operator()(const CycleAccting *acct) const;
}; };
class CycleAcctingEqual class CycleAcctingEqual

View File

@ -292,16 +292,16 @@ ExceptionPath::fromThruToPriority(ExceptionFrom *from,
return priority; return priority;
} }
Hash size_t
ExceptionPath::hash() const ExceptionPath::hash() const
{ {
return hash(nullptr); return hash(nullptr);
} }
Hash size_t
ExceptionPath::hash(ExceptionPt *missing_pt) const ExceptionPath::hash(ExceptionPt *missing_pt) const
{ {
Hash hash = typePriority(); size_t hash = typePriority();
int pot = 32; int pot = 32;
ExceptionPtIterator pt_iter(this); ExceptionPtIterator pt_iter(this);
while (pt_iter.hasNext()) { while (pt_iter.hasNext()) {
@ -942,7 +942,7 @@ ExceptionPt::ExceptionPt(const TransRiseFallBoth *tr,
// ExceptionPt initialization functions set hash_ and incrementally // ExceptionPt initialization functions set hash_ and incrementally
// maintain the value. // maintain the value.
Hash size_t
ExceptionPt::hash() const ExceptionPt::hash() const
{ {
return hash_; return hash_;
@ -1040,7 +1040,7 @@ ExceptionFromTo::findHash()
{ {
hash_ = 0; hash_ = 0;
if (pins_) { if (pins_) {
Hash hash = 0; size_t hash = 0;
PinSet::Iterator pin_iter(pins_); PinSet::Iterator pin_iter(pins_);
while (pin_iter.hasNext()) { while (pin_iter.hasNext()) {
const Pin *pin = pin_iter.next(); const Pin *pin = pin_iter.next();
@ -1049,7 +1049,7 @@ ExceptionFromTo::findHash()
hash_ += hash * hash_pin; hash_ += hash * hash_pin;
} }
if (clks_) { if (clks_) {
Hash hash = 0; size_t hash = 0;
ClockSet::Iterator clk_iter(clks_); ClockSet::Iterator clk_iter(clks_);
while (clk_iter.hasNext()) { while (clk_iter.hasNext()) {
Clock *clk = clk_iter.next(); Clock *clk = clk_iter.next();
@ -1058,7 +1058,7 @@ ExceptionFromTo::findHash()
hash_ += hash * hash_clk; hash_ += hash * hash_clk;
} }
if (insts_) { if (insts_) {
Hash hash = 0; size_t hash = 0;
InstanceSet::Iterator inst_iter(insts_); InstanceSet::Iterator inst_iter(insts_);
while (inst_iter.hasNext()) { while (inst_iter.hasNext()) {
Instance *inst = inst_iter.next(); Instance *inst = inst_iter.next();
@ -1931,7 +1931,7 @@ ExceptionThru::findHash()
{ {
hash_ = 0; hash_ = 0;
if (pins_) { if (pins_) {
Hash hash = 0; size_t hash = 0;
PinSet::Iterator pin_iter(pins_); PinSet::Iterator pin_iter(pins_);
while (pin_iter.hasNext()) { while (pin_iter.hasNext()) {
const Pin *pin = pin_iter.next(); const Pin *pin = pin_iter.next();
@ -1940,7 +1940,7 @@ ExceptionThru::findHash()
hash_ += hash * hash_pin; hash_ += hash * hash_pin;
} }
if (nets_) { if (nets_) {
Hash hash = 0; size_t hash = 0;
NetSet::Iterator net_iter(nets_); NetSet::Iterator net_iter(nets_);
while (net_iter.hasNext()) { while (net_iter.hasNext()) {
Net *net = net_iter.next(); Net *net = net_iter.next();
@ -1949,7 +1949,7 @@ ExceptionThru::findHash()
hash_ += hash * hash_net; hash_ += hash * hash_net;
} }
if (insts_) { if (insts_) {
Hash hash = 0; size_t hash = 0;
InstanceSet::Iterator inst_iter(insts_); InstanceSet::Iterator inst_iter(insts_);
while (inst_iter.hasNext()) { while (inst_iter.hasNext()) {
Instance *inst = inst_iter.next(); Instance *inst = inst_iter.next();
@ -2373,7 +2373,7 @@ ExceptionState::isComplete() const
&& exception_->to() == nullptr; && exception_->to() == nullptr;
} }
Hash size_t
ExceptionState::hash() const ExceptionState::hash() const
{ {
return hashSum(exception_->hash(), index_); return hashSum(exception_->hash(), index_);

View File

@ -20,7 +20,6 @@
#include "DisallowCopyAssign.hh" #include "DisallowCopyAssign.hh"
#include "Error.hh" #include "Error.hh"
#include "Set.hh" #include "Set.hh"
#include "Hash.hh"
#include "SdcCmdComment.hh" #include "SdcCmdComment.hh"
#include "SdcClass.hh" #include "SdcClass.hh"
@ -95,8 +94,8 @@ public:
static int fromThruToPriority(ExceptionFrom *from, static int fromThruToPriority(ExceptionFrom *from,
ExceptionThruSeq *thrus, ExceptionThruSeq *thrus,
ExceptionTo *to); ExceptionTo *to);
Hash hash() const; size_t hash() const;
Hash hash(ExceptionPt *missing_pt) const; size_t hash(ExceptionPt *missing_pt) const;
// Mergeable properties (independent of exception points). // Mergeable properties (independent of exception points).
virtual bool mergeable(ExceptionPath *exception) const = 0; virtual bool mergeable(ExceptionPath *exception) const = 0;
bool mergeablePts(ExceptionPath *exception) const; bool mergeablePts(ExceptionPath *exception) const;
@ -336,7 +335,7 @@ public:
virtual InstanceSet *instances() = 0; virtual InstanceSet *instances() = 0;
virtual NetSet *nets() = 0; virtual NetSet *nets() = 0;
virtual EdgePinsSet *edges() = 0; virtual EdgePinsSet *edges() = 0;
Hash hash() const; size_t hash() const;
virtual int nameCmp(ExceptionPt *pt, const Network *network) const = 0; virtual int nameCmp(ExceptionPt *pt, const Network *network) const = 0;
virtual void mergeInto(ExceptionPt *pt) = 0; virtual void mergeInto(ExceptionPt *pt) = 0;
// All pins and instance/net pins. // All pins and instance/net pins.
@ -361,14 +360,14 @@ protected:
bool own_pts_; bool own_pts_;
// Hash is cached because there may be many objects to speed up // Hash is cached because there may be many objects to speed up
// exception merging. // exception merging.
Hash hash_; size_t hash_;
// Maximum number of objects for asString() to show. // Maximum number of objects for asString() to show.
static const int as_string_max_objects_; static const int as_string_max_objects_;
static const Hash hash_clk = 3; static const size_t hash_clk = 3;
static const Hash hash_pin = 5; static const size_t hash_pin = 5;
static const Hash hash_net = 7; static const size_t hash_net = 7;
static const Hash hash_inst = 11; static const size_t hash_inst = 11;
private: private:
DISALLOW_COPY_AND_ASSIGN(ExceptionPt); DISALLOW_COPY_AND_ASSIGN(ExceptionPt);
@ -645,7 +644,7 @@ public:
ExceptionThru *nextThru() const { return next_thru_; } ExceptionThru *nextThru() const { return next_thru_; }
ExceptionState *nextState() const { return next_state_; } ExceptionState *nextState() const { return next_state_; }
void setNextState(ExceptionState *next_state); void setNextState(ExceptionState *next_state);
Hash hash() const; size_t hash() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(ExceptionState); DISALLOW_COPY_AND_ASSIGN(ExceptionState);

View File

@ -36,10 +36,10 @@ PinPairEqual::operator()(const PinPair *pair1,
&& pair1->second == pair2->second; && pair1->second == pair2->second;
} }
Hash size_t
PinPairHash::operator()(const PinPair *pair) const PinPairHash::operator()(const PinPair *pair) const
{ {
Hash hash = hash_init_value; size_t hash = hash_init_value;
hashIncr(hash, hashPtr(pair->first)); hashIncr(hash, hashPtr(pair->first));
hashIncr(hash, hashPtr(pair->second)); hashIncr(hash, hashPtr(pair->second));
return hash; return hash;

View File

@ -37,7 +37,7 @@ typedef Set<PinPair*, PinPairLess> PinPairSet;
class PinPairHash class PinPairHash
{ {
public: public:
Hash operator()(const PinPair *pair) const; size_t operator()(const PinPair *pair) const;
}; };
class PinPairEqual class PinPairEqual

View File

@ -4905,9 +4905,9 @@ void
Sdc::recordMergeHash(ExceptionPath *exception, Sdc::recordMergeHash(ExceptionPath *exception,
ExceptionPt *missing_pt) ExceptionPt *missing_pt)
{ {
Hash hash = exception->hash(missing_pt); size_t hash = exception->hash(missing_pt);
debugPrint3(debug_, "exception_merge", 3, debugPrint3(debug_, "exception_merge", 3,
"record merge hash %u %s missing %s\n", "record merge hash %zu %s missing %s\n",
hash, hash,
exception->asString(network_), exception->asString(network_),
missing_pt->asString(network_)); missing_pt->asString(network_));
@ -5120,7 +5120,7 @@ Sdc::findMergeMatch(ExceptionPath *exception)
ExceptionPtIterator missing_pt_iter(exception); ExceptionPtIterator missing_pt_iter(exception);
while (missing_pt_iter.hasNext()) { while (missing_pt_iter.hasNext()) {
ExceptionPt *missing_pt = missing_pt_iter.next(); ExceptionPt *missing_pt = missing_pt_iter.next();
Hash hash = exception->hash(missing_pt); size_t hash = exception->hash(missing_pt);
ExceptionPathSet *matches = exception_merge_hash_.findKey(hash); ExceptionPathSet *matches = exception_merge_hash_.findKey(hash);
if (matches) { if (matches) {
ExceptionPathSet::Iterator match_iter(matches); ExceptionPathSet::Iterator match_iter(matches);
@ -5341,9 +5341,9 @@ void
Sdc::unrecordMergeHash(ExceptionPath *exception, Sdc::unrecordMergeHash(ExceptionPath *exception,
ExceptionPt *missing_pt) ExceptionPt *missing_pt)
{ {
Hash hash = exception->hash(missing_pt); size_t hash = exception->hash(missing_pt);
debugPrint3(debug_, "exception_merge", 3, debugPrint3(debug_, "exception_merge", 3,
"unrecord merge hash %u %s missing %s\n", "unrecord merge hash %zu %s missing %s\n",
hash, hash,
exception->asString(network_), exception->asString(network_),
missing_pt->asString(network_)); missing_pt->asString(network_));

View File

@ -1260,7 +1260,7 @@ protected:
const Corner *corner, const Corner *corner,
const MinMax *min_max) const; const MinMax *min_max) const;
void removeClockGroups(ClockGroups *groups); void removeClockGroups(ClockGroups *groups);
void ensureClkGroupExclusions();; void ensureClkGroupExclusions();
void makeClkGroupExclusions(ClockGroups *clk_groups); void makeClkGroupExclusions(ClockGroups *clk_groups);
void makeClkGroupExclusions1(ClockGroupSet *groups); void makeClkGroupExclusions1(ClockGroupSet *groups);
void makeClkGroupExclusions(ClockGroupSet *groups); void makeClkGroupExclusions(ClockGroupSet *groups);

View File

@ -179,7 +179,7 @@ ClkInfo::refsFilter(const StaState *sta) const
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Hash size_t
ClkInfoHash::operator()(const ClkInfo *clk_info) ClkInfoHash::operator()(const ClkInfo *clk_info)
{ {
return clk_info->hash(); return clk_info->hash();

View File

@ -68,7 +68,7 @@ public:
bool refsFilter(const StaState *sta) const; bool refsFilter(const StaState *sta) const;
// This clk_info/tag is used for a generated clock source path. // This clk_info/tag is used for a generated clock source path.
bool isGenClkSrcPath() const { return is_gen_clk_src_path_; } bool isGenClkSrcPath() const { return is_gen_clk_src_path_; }
Hash hash() const { return hash_; } size_t hash() const { return hash_; }
protected: protected:
void findHash(const StaState *sta); void findHash(const StaState *sta);
@ -83,7 +83,7 @@ private:
ClockUncertainties *uncertainties_; ClockUncertainties *uncertainties_;
Arrival insertion_; Arrival insertion_;
float latency_; float latency_;
Hash hash_; size_t hash_;
unsigned int is_propagated_:1; unsigned int is_propagated_:1;
unsigned int is_gen_clk_src_path_:1; unsigned int is_gen_clk_src_path_:1;
unsigned int is_pulse_clk_:1; unsigned int is_pulse_clk_:1;
@ -106,7 +106,7 @@ protected:
class ClkInfoHash class ClkInfoHash
{ {
public: public:
Hash operator()(const ClkInfo *clk_info); size_t operator()(const ClkInfo *clk_info);
}; };
class ClkInfoEqual class ClkInfoEqual

View File

@ -44,7 +44,7 @@ typedef Vector<LibertyLibrary*> LibertySeq;
class Corners : public StaState class Corners : public StaState
{ {
public: public:
explicit Corners(StaState *sta);; explicit Corners(StaState *sta);
virtual ~Corners(); virtual ~Corners();
void clear(); void clear();
int count() const; int count() const;

View File

@ -18,7 +18,6 @@
#include "Stats.hh" #include "Stats.hh"
#include "Debug.hh" #include "Debug.hh"
#include "Report.hh" #include "Report.hh"
#include "Hash.hh"
#include "Network.hh" #include "Network.hh"
#include "PortDirection.hh" #include "PortDirection.hh"
#include "Graph.hh" #include "Graph.hh"
@ -1283,10 +1282,10 @@ ClockPinPairLess::operator()(const ClockPinPair &pair1,
class ClockPinPairHash class ClockPinPairHash
{ {
public: public:
Hash operator()(const ClockPinPair &pair) const; size_t operator()(const ClockPinPair &pair) const;
}; };
Hash size_t
ClockPinPairHash::operator()(const ClockPinPair &pair) const ClockPinPairHash::operator()(const ClockPinPair &pair) const
{ {
return hashSum(pair.first->index(), hashPtr(pair.second)); return hashSum(pair.first->index(), hashPtr(pair.second));

View File

@ -458,7 +458,7 @@ protected:
string descriptionField(Vertex *vertex); string descriptionField(Vertex *vertex);
bool reportClkPath() const; bool reportClkPath() const;
string clkName(const Clock *clk, string clkName(const Clock *clk,
bool inverted);; bool inverted);
bool hasExtInputDriver(const Pin *pin, bool hasExtInputDriver(const Pin *pin,
const TransRiseFall *tr, const TransRiseFall *tr,
const MinMax *min_max); const MinMax *min_max);
@ -504,7 +504,7 @@ protected:
// Return value. // Return value.
PathRef &ref_path); PathRef &ref_path);
const char *asRisingFalling(const TransRiseFall *tr); const char *asRisingFalling(const TransRiseFall *tr);
const char *asRiseFall(const TransRiseFall *tr);; const char *asRiseFall(const TransRiseFall *tr);
// Path options. // Path options.
ReportPathFormat format_; ReportPathFormat format_;

View File

@ -2811,7 +2811,7 @@ Search::reportTagGroups() const
tag_group->reportArrivalMap(this); tag_group->reportArrivalMap(this);
} }
} }
Hash long_hash = tag_group_set_->longestBucketHash(); size_t long_hash = tag_group_set_->longestBucketHash();
report_->print("Longest hash bucket length %lu hash=%lu\n", report_->print("Longest hash bucket length %lu hash=%lu\n",
tag_group_set_->bucketLength(long_hash), tag_group_set_->bucketLength(long_hash),
long_hash); long_hash);
@ -2927,8 +2927,8 @@ Search::reportTags() const
tag->hash() % tag_set_->capacity(), tag->hash() % tag_set_->capacity(),
tag->asString(false, this)) ; tag->asString(false, this)) ;
} }
Hash long_hash = tag_set_->longestBucketHash(); size_t long_hash = tag_set_->longestBucketHash();
printf("Longest hash bucket length %d hash=%u\n", printf("Longest hash bucket length %d hash=%zu\n",
tag_set_->bucketLength(long_hash), tag_set_->bucketLength(long_hash),
long_hash); long_hash);
} }

View File

@ -21,7 +21,6 @@
#include "Set.hh" #include "Set.hh"
#include "Map.hh" #include "Map.hh"
#include "UnorderedMap.hh" #include "UnorderedMap.hh"
#include "Hash.hh"
#include "StringSet.hh" #include "StringSet.hh"
#include "Delay.hh" #include "Delay.hh"
#include "NetworkClass.hh" #include "NetworkClass.hh"
@ -77,7 +76,7 @@ class TagMatchHash
public: public:
TagMatchHash(bool match_crpr_clk_pin, TagMatchHash(bool match_crpr_clk_pin,
const StaState *sta); const StaState *sta);
Hash operator()(const Tag *tag) const; size_t operator()(const Tag *tag) const;
protected: protected:
bool match_crpr_clk_pin_; bool match_crpr_clk_pin_;

View File

@ -274,7 +274,7 @@ Tag::findHash()
hashIncr(match_hash_, clk_info_->isGenClkSrcPath()); hashIncr(match_hash_, clk_info_->isGenClkSrcPath());
} }
Hash size_t
Tag::matchHash(bool match_crpr_clk_pin) const Tag::matchHash(bool match_crpr_clk_pin) const
{ {
if (match_crpr_clk_pin) if (match_crpr_clk_pin)
@ -317,8 +317,8 @@ tagCmp(const Tag *tag1,
if (path_ap_index1 > path_ap_index2) if (path_ap_index1 > path_ap_index2)
return 1; return 1;
Hash clk_info1 = tag1->clkInfo()->hash(); size_t clk_info1 = tag1->clkInfo()->hash();
Hash clk_info2 = tag2->clkInfo()->hash(); size_t clk_info2 = tag2->clkInfo()->hash();
if (clk_info1 < clk_info2) if (clk_info1 < clk_info2)
return -1; return -1;
if (clk_info1 > clk_info2) if (clk_info1 > clk_info2)
@ -650,7 +650,7 @@ tagStateEqualCrpr(const Tag *tag1,
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Hash size_t
TagHash::operator()(const Tag *tag) TagHash::operator()(const Tag *tag)
{ {
return tag->hash(); return tag->hash();
@ -670,7 +670,7 @@ TagMatchHash::TagMatchHash(bool match_crpr_clk_pin,
{ {
} }
Hash size_t
TagMatchHash::operator()(const Tag *tag) const TagMatchHash::operator()(const Tag *tag) const
{ {
return tag->matchHash(match_crpr_clk_pin_); return tag->matchHash(match_crpr_clk_pin_);

View File

@ -20,7 +20,6 @@
#include "DisallowCopyAssign.hh" #include "DisallowCopyAssign.hh"
#include "Vector.hh" #include "Vector.hh"
#include "Set.hh" #include "Set.hh"
#include "Hash.hh"
#include "SearchClass.hh" #include "SearchClass.hh"
#include "SdcClass.hh" #include "SdcClass.hh"
#include "Transition.hh" #include "Transition.hh"
@ -79,8 +78,8 @@ public:
bool isLoop() const { return is_loop_; } bool isLoop() const { return is_loop_; }
bool isFilter() const { return is_filter_; } bool isFilter() const { return is_filter_; }
bool isSegmentStart() const { return is_segment_start_; } bool isSegmentStart() const { return is_segment_start_; }
Hash hash() const { return hash_; } size_t hash() const { return hash_; }
Hash matchHash(bool match_crpr_clk_pin) const; size_t matchHash(bool match_crpr_clk_pin) const;
protected: protected:
void findHash(); void findHash();
@ -91,8 +90,8 @@ private:
ClkInfo *clk_info_; ClkInfo *clk_info_;
InputDelay *input_delay_; InputDelay *input_delay_;
ExceptionStateSet *states_; ExceptionStateSet *states_;
Hash hash_; size_t hash_;
Hash match_hash_; size_t match_hash_;
bool is_clk_:1; bool is_clk_:1;
bool is_filter_:1; bool is_filter_:1;
bool is_loop_:1; bool is_loop_:1;
@ -121,7 +120,7 @@ public:
class TagHash class TagHash
{ {
public: public:
Hash operator()(const Tag *tag); size_t operator()(const Tag *tag);
}; };
class TagEqual class TagEqual

View File

@ -58,10 +58,10 @@ TagGroup::~TagGroup()
delete arrival_map_; delete arrival_map_;
} }
Hash size_t
TagGroup::arrivalMapHash(ArrivalMap *arrival_map) TagGroup::arrivalMapHash(ArrivalMap *arrival_map)
{ {
Hash hash = 0; size_t hash = 0;
ArrivalMap::Iterator arrival_iter(arrival_map); ArrivalMap::Iterator arrival_iter(arrival_map);
while (arrival_iter.hasNext()) { while (arrival_iter.hasNext()) {
Tag *tag; Tag *tag;
@ -338,7 +338,7 @@ TagGroupBldr::copyArrivals(TagGroup *tag_group,
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Hash size_t
TagGroupHash::operator()(const TagGroup *group) const TagGroupHash::operator()(const TagGroup *group) const
{ {
return group->hash(); return group->hash();

View File

@ -23,7 +23,6 @@
#include "Iterator.hh" #include "Iterator.hh"
#include "MinMax.hh" #include "MinMax.hh"
#include "Transition.hh" #include "Transition.hh"
#include "Hash.hh"
#include "GraphClass.hh" #include "GraphClass.hh"
#include "SearchClass.hh" #include "SearchClass.hh"
#include "Tag.hh" #include "Tag.hh"
@ -47,7 +46,7 @@ public:
TagGroup(TagGroupBldr *tag_bldr); TagGroup(TagGroupBldr *tag_bldr);
~TagGroup(); ~TagGroup();
TagGroupIndex index() const { return index_; } TagGroupIndex index() const { return index_; }
Hash hash() const { return hash_; } size_t hash() const { return hash_; }
void report(const StaState *sta) const; void report(const StaState *sta) const;
void reportArrivalMap(const StaState *sta) const; void reportArrivalMap(const StaState *sta) const;
bool hasClkTag() const { return has_clk_tag_; } bool hasClkTag() const { return has_clk_tag_; }
@ -67,11 +66,11 @@ public:
bool hasTag(Tag *tag) const; bool hasTag(Tag *tag) const;
protected: protected:
Hash arrivalMapHash(ArrivalMap *arrival_map); size_t arrivalMapHash(ArrivalMap *arrival_map);
// tag -> arrival index // tag -> arrival index
ArrivalMap *arrival_map_; ArrivalMap *arrival_map_;
Hash hash_; size_t hash_;
unsigned int index_:tag_group_index_bits; unsigned int index_:tag_group_index_bits;
unsigned int has_clk_tag_:1; unsigned int has_clk_tag_:1;
unsigned int has_genclk_src_tag_:1; unsigned int has_genclk_src_tag_:1;
@ -86,7 +85,7 @@ private:
class TagGroupHash class TagGroupHash
{ {
public: public:
Hash operator()(const TagGroup *tag) const; size_t operator()(const TagGroup *tag) const;
}; };
class TagGroupEqual class TagGroupEqual

View File

@ -72,7 +72,7 @@ public:
const char *gnd_name, const char *gnd_name,
const StaState *sta); const StaState *sta);
~WritePathSpice(); ~WritePathSpice();
void writeSpice();; void writeSpice();
private: private:
void writeHeader(); void writeHeader();
@ -228,7 +228,7 @@ class SubcktEndsMissing : public StaException
{ {
public: public:
SubcktEndsMissing(const char *cell_name, SubcktEndsMissing(const char *cell_name,
const char *subckt_filename);; const char *subckt_filename);
const char *what() const throw(); const char *what() const throw();
protected: protected:

View File

@ -20,10 +20,10 @@
namespace sta { namespace sta {
Hash size_t
hashString(const char *str) hashString(const char *str)
{ {
unsigned hash = hash_init_value; size_t hash = hash_init_value;
size_t length = strlen(str); size_t length = strlen(str);
for (size_t i = 0; i < length; i++) for (size_t i = 0; i < length; i++)
hash = ((hash << 5) + hash) ^ str[i]; hash = ((hash << 5) + hash) ^ str[i];

View File

@ -17,26 +17,26 @@
#ifndef STA_HASH_H #ifndef STA_HASH_H
#define STA_HASH_H #define STA_HASH_H
#include <stddef.h> // size_t #include <cstddef>
namespace sta { namespace sta {
typedef unsigned int Hash; using std::size_t;
const Hash hash_init_value = 5381; const size_t hash_init_value = 5381;
// Dan Bernstein, comp.lang.c. // Dan Bernstein, comp.lang.c.
inline Hash inline size_t
hashSum(Hash hash, hashSum(size_t hash,
Hash add) size_t add)
{ {
// hash * 31 ^ add. // hash * 31 ^ add.
return ((hash << 5) + hash) ^ add; return ((hash << 5) + hash) ^ add;
} }
inline void inline void
hashIncr(Hash &hash, hashIncr(size_t &hash,
Hash add) size_t add)
{ {
// hash * 31 ^ add. // hash * 31 ^ add.
hash = ((hash << 5) + hash) ^ add; hash = ((hash << 5) + hash) ^ add;
@ -49,7 +49,7 @@ nextMersenne(size_t n)
} }
// Sadly necessary until c++ std::hash works for char *. // Sadly necessary until c++ std::hash works for char *.
Hash size_t
hashString(const char *str); hashString(const char *str);
} // namespace } // namespace

View File

@ -18,7 +18,6 @@
#define STA_HASHSET_H #define STA_HASHSET_H
#include <stddef.h> // size_t #include <stddef.h> // size_t
#include "Hash.hh"
namespace sta { namespace sta {
@ -51,8 +50,8 @@ public:
void clear(); void clear();
void deleteContentsClear(); void deleteContentsClear();
int longestBucketLength() const; int longestBucketLength() const;
Hash longestBucketHash() const; size_t longestBucketHash() const;
int bucketLength(Hash hash) const; int bucketLength(size_t hash) const;
void void
deleteContents() deleteContents()
@ -424,11 +423,11 @@ HashSet<KEY, HASH, EQUAL>::longestBucketLength() const
} }
template <class KEY, class HASH, class EQUAL> template <class KEY, class HASH, class EQUAL>
Hash size_t
HashSet<KEY, HASH, EQUAL>::longestBucketHash() const HashSet<KEY, HASH, EQUAL>::longestBucketHash() const
{ {
int longest = 0; int longest = 0;
Hash longest_hash = 0; size_t longest_hash = 0;
for (size_t hash = 0; hash < capacity_; hash++) { for (size_t hash = 0; hash < capacity_; hash++) {
int length = bucketLength(hash); int length = bucketLength(hash);
if (length > longest) { if (length > longest) {
@ -441,7 +440,7 @@ HashSet<KEY, HASH, EQUAL>::longestBucketHash() const
template <class KEY, class HASH, class EQUAL> template <class KEY, class HASH, class EQUAL>
int int
HashSet<KEY, HASH, EQUAL>::bucketLength(Hash hash) const HashSet<KEY, HASH, EQUAL>::bucketLength(size_t hash) const
{ {
int length = 0; int length = 0;
for (HashSetBucket<KEY> *bucket = table_[hash]; for (HashSetBucket<KEY> *bucket = table_[hash];