C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

unification.cc File Reference

#include "unification.h"
#include "linker.h"
#include "memoryblock.h"
#include "memorymodel.h"
#include "location.h"

Go to the source code of this file.

Compounds

class  findVarAssign
class  testUnify

Defines

#define delete_and_return
#define size_operand(x, value)
#define new_field_ECR(X, type, container)
#define huge_pending   1400
#define is_dismantler_tmp(name)   ((name).find("__T") == 0)
#define ensure_parent_child(child, parent, child_type)
#define return_unify(t)
#define max_Lambda(t1, ty1, t2, ty2, l)
#define sizeOfType(t, ty)
#define max_Size(t1, ty1, t2, ty2, s)
#define parentsOfType(t, ty)
#define max_Parents(t1, ty1, t2, ty2, p)
#define consolidate_struct_fields(struc, result)
#define consolidate_sim_obj_fields(alpha, result)
#define insert_into_set(set, Dp)
#define CX_INVARIANT
#define print_one_ecr(E)

Variables

bool debug = false
Phases unify_phase ("unify", new testUnify())


Define Documentation

#define consolidate_sim_obj_fields alpha,
result   
 

Value:

{\
    if(result) join(result,alpha->tao()); \
    else result = alpha->tao(); \
  }

#define consolidate_struct_fields struc,
result   
 

Value:

{\
    EltMap map = struc->m; \
    for(EltMap::iterator m=map.begin(); m!=map.end(); m++) \
      if(m->second) { \
        if(result) join(result, m->second); \
        else result = m->second; \
      } \
  }

#define CX_INVARIANT
 

#define delete_and_return
 

Value:

{ \
  if(is_new) delete p; \
  return; \
}

#define ensure_parent_child child,
parent,
child_type   
 

Value:

{ \
  switch(child->type()->objTyp()) { \
    case BOTTOM: { \
      Unify_Size child_size(Unify_Size::sizeOf(child_type)); \
      settype(child, new UnifyType(new Unify_Blank(child_size, \
                                                   Unify_Parents(false))));\
        \
    } \
    case BLANK: child->type()->blank()->p.parents().insert(parent); break; \
    case SIMPLE: child->type()->simple()->p.parents().insert(parent); break; \
    case STRUCTURE: child->type()->structure()->p.parents().insert(parent); \
                    break; \
    case OBJECT: child->type()->object()->p.parents().insert(parent); \
  } }

#define huge_pending   1400
 

Definition at line 629 of file unification.cc.

Referenced by Unify_ECR::print(), and UnificationBasedPtr::settype().

#define insert_into_set set,
Dp   
 

Value:

{ \
  if(Dp == n_pos.back()) set->insert(n.begin(), n.end()); \
  else                   set->insert(Dp); \
  if(Dp != n_pos.front()) { \
      \
    for(declSet::iterator N=n.begin(); N!=n.end(); N++) { \
      decl_list all_fields = _field2sue[*N]->fields(); \
      FieldOrder::iterator fo1 = s->fo.begin(); \
      for(decl_list_p f=all_fields.begin(); f!=all_fields.end(); f++) { \
        if(_fieldpos[*f].size() >= _fieldpos[Dp].size()) break; \
        else { \
          Unify_ECR *E = s->m[*fo1]; \
          s->m.erase(*fo1); \
          fo1->insert(*f); \
          s->m[*fo1] = E; \
          break; \
        } \
        if(++fo1==s->fo.end()) break; \
      } \
    } \
  } \
}

#define is_dismantler_tmp name       ((name).find("__T") == 0)
 

Definition at line 959 of file unification.cc.

Referenced by UnificationBasedPtr::at_decl(), and UnificationBasedPtr::mergeOperand().

#define max_Lambda t1,
ty1,
t2,
ty2,
 
 

Value:

if(t1->is_bottom() || ty1==STRUCTURE || ty1==BLANK) { \
    is_Sim_Obj(t2); \
    l = Sim_Obj_Lambda(t2); \
  } else if(t2->is_bottom() || ty2==STRUCTURE || ty2==BLANK) { \
    is_Sim_Obj(t1); \
    l = Sim_Obj_Lambda(t1); \
  } else { \
    l = Sim_Obj_Lambda(t1); \
    Lambda *l2 = Sim_Obj_Lambda(t2); \
    if(l->leq(l2)) l=l2; \
    else if(l2->leq(l)) ; \
    else join(l,l2); \
  }

#define max_Parents t1,
ty1,
t2,
ty2,
 
 

Value:

if(t1->is_bottom()) \
    p = parentsOfType(t2,ty2); \
  else if(t2->is_bottom()) \
    p = parentsOfType(t1,ty1); \
  else { \
    Unify_Parents p1 = parentsOfType(t1,ty1), \
                  p2 = parentsOfType(t2,ty2); \
    for(set<Unify_ECR*>::iterator P=p1.parents().begin(); \
        P!=p1.parents().end(); P++)\
      p.parents().insert((*P)->root()); \
    for(set<Unify_ECR*>::iterator P=p2.parents().begin(); \
        P!=p2.parents().end(); P++)\
      p.parents().insert((*P)->root()); \
    if(!p1.is_top() || ! p2.is_top()) p.top(false); \
  }

#define max_Size t1,
ty1,
t2,
ty2,
 
 

Value:

if(t1->is_bottom()) \
    s = sizeOfType(t2,ty2); \
  else if(t2->is_bottom()) \
    s = sizeOfType(t1,ty1); \
  else { \
    s = sizeOfType(t1,ty1); \
    Unify_Size s2 = sizeOfType(t2,ty2); \
    if(s.is_top()) ; \
    else if(s2.is_top()) s=s2; \
    else if( s.size() < s2.size() ) s=s2; \
  }

#define new_field_ECR X,
type,
container   
 

Value:

{\
    set<Unify_ECR*> ps;  ps.insert(container->root()); \
    Unify_Parents p(ps); \
    if(type) { \
      Unify_Size size(Unify_Size::sizeOf(type)); \
      X = (new UnifyType( new Unify_Blank(size,p)))->ecr(); \
    } else { \
      Unify_Size size; \
      X = (new UnifyType( new Unify_Blank(size,p)))->ecr(); \
    }}

#define parentsOfType t,
ty   
 

Value:

((ty==OBJECT) ? t->object()->p : \
   (ty==SIMPLE) ? t->simple()->p : \
   (ty==STRUCTURE) ? t->structure()->p : \
   (ty==BLANK) ? t->blank()->p : Unify_Parents(true))

#define print_one_ecr  
 

Value:

(E)->print(); \
  cout << endl;

#define return_unify  
 

Value:

{ \
  UnifyType *T = (t)->ecr()->type();   \
  memoryBlock *block = t1->block() ? t1->block() : t2->block(); \
  if(! T->block()) T->block(block); \
  else assert(T->block()==block); \
  \
  if(t1 != T) T->procs().insert(t1->procs().begin(), t1->procs().end()); \
  if(t2 != T) T->procs().insert(t2->procs().begin(), t2->procs().end()); \
  \
  return T; \
}

#define size_operand x,
value   
 

#define sizeOfType t,
ty   
 

Value:

((ty==OBJECT) ? t->object()->s : \
   (ty==SIMPLE) ? t->simple()->s : \
   (ty==STRUCTURE) ? t->structure()->s : \
   (ty==BLANK) ? t->blank()->s : Unify_Size())


Variable Documentation

bool debug = false [static]
 

Definition at line 8 of file unification.cc.

Referenced by UnificationBasedPtr::at_decl().

Phases unify_phase("unify", new testUnify())
 


Generated on August 27, 2003
Back to the C-Breeze home page