yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minisat::ClauseAllocator Class Reference

#include <SolverTypes.h>

+ Collaboration diagram for Minisat::ClauseAllocator:

Public Types

enum  { Unit_Size = RegionAllocator<uint32_t>::Unit_Size }
 

Public Member Functions

 ClauseAllocator (uint32_t start_cap)
 
 ClauseAllocator ()
 
void moveTo (ClauseAllocator &to)
 
CRef alloc (const vec< Lit > &ps, bool learnt=false)
 
CRef alloc (const Clause &from)
 
uint32_t size () const
 
uint32_t wasted () const
 
Clauseoperator[] (CRef r)
 
const Clauseoperator[] (CRef r) const
 
Clauselea (CRef r)
 
const Clauselea (CRef r) const
 
CRef ael (const Clause *t)
 
void free (CRef cid)
 
void reloc (CRef &cr, ClauseAllocator &to)
 

Data Fields

bool extra_clause_field
 

Static Private Member Functions

static uint32_t clauseWord32Size (int size, bool has_extra)
 

Private Attributes

RegionAllocator< uint32_t > ra
 

Detailed Description

Definition at line 226 of file SolverTypes.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

Minisat::ClauseAllocator::ClauseAllocator ( uint32_t  start_cap)
inline

Definition at line 238 of file SolverTypes.h.

238 : ra(start_cap), extra_clause_field(false){}
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228
Minisat::ClauseAllocator::ClauseAllocator ( )
inline

Definition at line 239 of file SolverTypes.h.

239 : extra_clause_field(false){}

Member Function Documentation

CRef Minisat::ClauseAllocator::ael ( const Clause t)
inline

Definition at line 271 of file SolverTypes.h.

271 { return ra.ael((uint32_t*)t); }
Ref ael(const T *t)
Definition: Alloc.h:68
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

CRef Minisat::ClauseAllocator::alloc ( const vec< Lit > &  ps,
bool  learnt = false 
)
inline

Definition at line 245 of file SolverTypes.h.

246  {
247  assert(sizeof(Lit) == sizeof(uint32_t));
248  assert(sizeof(float) == sizeof(uint32_t));
249  bool use_extra = learnt | extra_clause_field;
250  CRef cid = ra.alloc(clauseWord32Size(ps.size(), use_extra));
251  new (lea(cid)) Clause(ps, use_extra, learnt);
252 
253  return cid;
254  }
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:137
Ref alloc(int size)
Definition: Alloc.h:111
static uint32_t clauseWord32Size(int size, bool has_extra)
Definition: SolverTypes.h:230
Size size(void) const
Definition: Vec.h:64
Clause * lea(CRef r)
Definition: SolverTypes.h:269
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CRef Minisat::ClauseAllocator::alloc ( const Clause from)
inline

Definition at line 256 of file SolverTypes.h.

257  {
258  bool use_extra = from.learnt() | extra_clause_field;
259  CRef cid = ra.alloc(clauseWord32Size(from.size(), use_extra));
260  new (lea(cid)) Clause(from, use_extra);
261  return cid; }
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:137
Ref alloc(int size)
Definition: Alloc.h:111
static uint32_t clauseWord32Size(int size, bool has_extra)
Definition: SolverTypes.h:230
Clause * lea(CRef r)
Definition: SolverTypes.h:269
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

static uint32_t Minisat::ClauseAllocator::clauseWord32Size ( int  size,
bool  has_extra 
)
inlinestaticprivate

Definition at line 230 of file SolverTypes.h.

230  {
231  return (sizeof(Clause) + (sizeof(Lit) * (size + (int)has_extra))) / sizeof(uint32_t); }
uint32_t size() const
Definition: SolverTypes.h:263

+ Here is the caller graph for this function:

void Minisat::ClauseAllocator::free ( CRef  cid)
inline

Definition at line 273 of file SolverTypes.h.

274  {
275  Clause& c = operator[](cid);
276  ra.free(clauseWord32Size(c.size(), c.has_extra()));
277  }
static uint32_t clauseWord32Size(int size, bool has_extra)
Definition: SolverTypes.h:230
Clause & operator[](CRef r)
Definition: SolverTypes.h:267
void free(int size)
Definition: Alloc.h:60
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Clause* Minisat::ClauseAllocator::lea ( CRef  r)
inline

Definition at line 269 of file SolverTypes.h.

269 { return (Clause*)ra.lea(r); }
T * lea(Ref r)
Definition: Alloc.h:66
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Clause* Minisat::ClauseAllocator::lea ( CRef  r) const
inline

Definition at line 270 of file SolverTypes.h.

270 { return (Clause*)ra.lea(r);; }
T * lea(Ref r)
Definition: Alloc.h:66
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

void Minisat::ClauseAllocator::moveTo ( ClauseAllocator to)
inline

Definition at line 241 of file SolverTypes.h.

241  {
242  to.extra_clause_field = extra_clause_field;
243  ra.moveTo(to.ra); }
void moveTo(RegionAllocator &to)
Definition: Alloc.h:71
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

Clause& Minisat::ClauseAllocator::operator[] ( CRef  r)
inline

Definition at line 267 of file SolverTypes.h.

267 { return (Clause&)ra[r]; }
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the caller graph for this function:

const Clause& Minisat::ClauseAllocator::operator[] ( CRef  r) const
inline

Definition at line 268 of file SolverTypes.h.

268 { return (Clause&)ra[r]; }
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228
void Minisat::ClauseAllocator::reloc ( CRef cr,
ClauseAllocator to 
)
inline

Definition at line 279 of file SolverTypes.h.

280  {
281  Clause& c = operator[](cr);
282 
283  if (c.reloced()) { cr = c.relocation(); return; }
284 
285  cr = to.alloc(c);
286  c.relocate(cr);
287  }
Clause & operator[](CRef r)
Definition: SolverTypes.h:267

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t Minisat::ClauseAllocator::size ( void  ) const
inline

Definition at line 263 of file SolverTypes.h.

263 { return ra.size(); }
uint32_t size() const
Definition: Alloc.h:56
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t Minisat::ClauseAllocator::wasted ( ) const
inline

Definition at line 264 of file SolverTypes.h.

264 { return ra.wasted(); }
uint32_t wasted() const
Definition: Alloc.h:57
RegionAllocator< uint32_t > ra
Definition: SolverTypes.h:228

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

bool Minisat::ClauseAllocator::extra_clause_field

Definition at line 236 of file SolverTypes.h.

RegionAllocator<uint32_t> Minisat::ClauseAllocator::ra
private

Definition at line 228 of file SolverTypes.h.


The documentation for this class was generated from the following file: