Ejemplo n.º 1
0
void store(char *R, quad *a, qnode *current){
	int n_cur = current->nestingLevel;
	char *sz;
	switch (a->type){
	case QUAD_SE:
		if (sizeOfType(a->value.se->u.eVariable.type) == 2)
			sz = "word";
		else if(sizeOfType(a->value.se->u.eVariable.type) == 1)
			sz = "byte";
		/*CHECK THIS HACK LATER*/
		if (a->value.se->nestingLevel == 2) 
			a->value.se->nestingLevel = 3;
		char *sign;
		if(a->value.se->u.eParameter.offset >= 0) sign="+";
		else sign="";

		if(n_cur == a->value.se->nestingLevel) {
			if(a->value.se->entryType == ENTRY_PARAMETER &&
				a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				fprintf(fp, "\tmov\tsi, word ptr [bp%s%d]\n",
				sign, a->value.se->u.eParameter.offset);
				fprintf(fp, "\tmov\t%s ptr [si], %s\n", sz, R);
			}
			else fprintf(fp, "\tmov\t%s ptr [bp%s%d], %s\n",
				sz, sign, a->value.se->u.eVariable.offset, R);
		}
		else {
			if(a->value.se->entryType == ENTRY_PARAMETER && 
				a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				getAR(a, current);
				fprintf(fp, "\tmov\tsi, word ptr [si+%d]\n"
				, a->value.se->u.eParameter.offset);

				fprintf(fp, "\tmov\t%s ptr [si], %s\n", sz, R);
			}
			else {
				getAR(a, current);
				fprintf(fp, "\tmov\t%s ptr [si+%d], %s\n",
				sz, a->value.se->u.eParameter.offset, R);
			}
		}
		break;
	case QUAD_POINTER:
		a->type = QUAD_SE;
		store("di", a, current);
		if (sizeOfType(a->value.se->u.eVariable.type->refType) == 2)
			sz = "word";
		else if(sizeOfType(a->value.se->u.eVariable.type->refType) == 1)
			sz = "byte";
		fprintf(fp, "\tmov\t%s ptr[di], %s\n", sz, R);
		break;
	default:
		break;
	}
}
Ejemplo n.º 2
0
void loadAddr(char *R, quad *a, qnode *current){
	int n_cur = current->nestingLevel;
	char *sz;
	switch (a->type){
	case QUAD_STR:
		if (string_no == 0) {
			str_list =  malloc( sizeof(string_node) ); 
			head_str = str_list;
		}
		else {
			str_list->next =  malloc( sizeof(string_node) ); 
			str_list = str_list->next;
		}
		str_list->next = NULL;
		str_list->str = a->value.strval; 
		fprintf(fp, "\tlea\t%s, byte ptr @str%d\n", R, string_no);
		string_no++;
		break;
	case QUAD_SE:
		if (sizeOfType(a->value.se->u.eVariable.type) == 2)
			sz = "word";
		else if (sizeOfType(a->value.se->u.eVariable.type) == 1)
			sz = "byte";
		if(n_cur == a->value.se->nestingLevel)
			if(a->value.se->entryType == ENTRY_PARAMETER && a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				fprintf(fp, "\tmov\t%s, word ptr [bp%d]\n", R, a->value.se->u.eParameter.offset);
			}
			else fprintf(fp, "\tlea\t%s, %s ptr [bp%d]\n", R,
				sz, a->value.se->u.eVariable.offset);
		else 
			if(a->value.se->entryType == ENTRY_PARAMETER && a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				getAR(a, current);
				fprintf(fp, "\tmov\t%s, word ptr [si+%d]\n", R,
				a->value.se->u.eParameter.offset);
			}
			else getAR(a, current), fprintf(fp, "\tlea\t%s, %s ptr [si+%d]\n", R,
				sz, a->value.se->u.eVariable.offset);
		break;
	case QUAD_POINTER:
		load(R, a, current);
		break;
	default:
		fprintf(stdout, "Could not loadAddr for such type\n");
	}
}
Ejemplo n.º 3
0
int sizeOfType(Type* type) {
  switch (type->typeClass) {
  case TP_INT:
    return INT_SIZE;
  case TP_CHAR:
    return CHAR_SIZE;
  case TP_ARRAY:
    return (type->arraySize * sizeOfType(type->elementType));
  }
  return 0;
}
Ejemplo n.º 4
0
static size_t SAC4SNetAllocSize(void *data)
{
  int dims, num_elems = 1;

  dims = SACARGgetDim(data);
  for (int i = 0; i < dims; i++) {
    num_elems *= SACARGgetShape(data, i);
  }

  return num_elems * sizeOfType(SACARGgetBasetype(data));
}
Ejemplo n.º 5
0
int sizeOfType(Type* type) {
    // TODO
    if(type->typeClass == TP_INT)
        return INT_SIZE;
    else if(type->typeClass == TP_CHAR)
        return CHAR_SIZE;
    else if(type->typeClass == TP_ARRAY)
        return (type->arraySize*sizeOfType(type->elementType));
    else return 0;

}
Ejemplo n.º 6
0
static void *SAC4SNetMPIUnpackFun(void *buf)
{
  int *shape;
  SACarg *result = NULL;
  void *contents = NULL;
  int type, dims, num_elems = 1;

  SNetDistribUnpack(buf, &type, sizeof(type));
  SNetDistribUnpack(buf, &dims, sizeof(dims));
  shape = SNetMemAlloc(dims * sizeof(int));
  SNetDistribUnpack(buf, shape, dims * sizeof(int));

  for (int i = 0; i < dims; i++) {
    num_elems *= shape[i];
  }

  contents = SNetMemAlloc(num_elems * sizeOfType(type));
  SNetDistribUnpack(buf, contents, num_elems * sizeOfType(type));

  switch (type) {
    case SACint:
      result = SACARGconvertFromIntPointerVect(contents, dims, shape);
      break;
    case SACflt:
      result = SACARGconvertFromFloatPointerVect(contents, dims, shape);
      break;
    case SACdbl:
      result = SACARGconvertFromDoublePointerVect(contents, dims, shape);
      break;
    default:
      Error( "Unsupported basetype in unpack function.");
      break;
  }

  SNetMemFree(shape);

  return result;
}
Ejemplo n.º 7
0
void SymInfo::declare( const string &name, ostream &out ) const
{
 
	if ( isTemp == true )
		return;

	assert ( Type( ) != FUNC || !_isReg );

	if ( isStatic( ) )
		out << "static ";

	if ( isConst( ) )
		out << " const ";

	if ( isUnsigned( ) )
		out << " unsigned ";

	//output the type
	if ( Type( ) == NOTYPE ) {
		if ( getSize( ) == 4 )
			out << e2str( LONG ) << ' ';
		else if ( getSize( ) == 2 )
			out << e2str( SINT ) << ' ';
		else if ( getSize( ) == 1 )
			out << e2str( CHAR ) << ' ';
		else
			out << e2str( LONG ) << ' ';
	}
	else
		out << e2str( Type( ) ) << ' ';

	out << name;
	if ( isArray( ) )
		out << "[ " << getSize( ) / sizeOfType( getType( ) ) << " ]";

        if ( initValue.size( ) ) {
		out << "= ";
		if ( Type( ) == FLOAT )
			out << convert2Float( atoi( initValue ) );
		else if ( Type( ) == CHAR )
			cout << getChar( atoi( initValue ) );
		else
                	out << initValue;
	}
        out << ';';
}
Ejemplo n.º 8
0
    ProgramInstance::ProgramInstance( ProgramSharedPtr const& program )
      : m_program( program )
    {
      GLint programID = program->getGLId();

      m_shaderStorageBuffers.resize( program->getShaderStorageBlocks().size() );
#if !defined(NDEBUG)
      for ( size_t i=0 ; i<m_shaderStorageBuffers.size() ; i++ )
      {
        m_unsetShaderStorageBlocks.insert( i );
      }
#endif

      std::vector<Program::Uniform> const& uniforms = program->getActiveUniforms();
      for ( size_t i=0 ; i<uniforms.size() ; i++ )
      {
        if ( isImageType( uniforms[i].type ) )
        {
          m_imageUniforms.insert( std::make_pair( i, ImageUniformData() ) );
        }
        else if ( isSamplerType( uniforms[i].type ) )
        {
          m_samplerUniforms.insert( std::make_pair( i, SamplerUniformData() ) );
        }
        else if ( uniforms[i].location != -1 )
        {
          std::map<size_t,std::vector<char>>::iterator it = m_uniforms.insert( std::make_pair( i, std::vector<char>() ) ).first;
          it->second.resize( sizeOfType( uniforms[i].type ) );
        }

#if !defined(NDEBUG)
        m_unsetUniforms.insert( i );
#endif
      }

      std::vector<Program::Block> const& blocks = program->getActiveUniformBlocks();
      m_uniformBuffers.resize( blocks.size() );
      for ( size_t i=0 ; i<m_uniformBuffers.size() ; i++ )
      {
        m_uniformBuffers[i] = dp::gl::Buffer::create( Buffer::CORE, GL_DYNAMIC_DRAW, GL_UNIFORM_BUFFER );
        m_uniformBuffers[i]->setSize( blocks[i].dataSize );
      }
    }
Ejemplo n.º 9
0
void declareObject(Object* obj) {
  Object* owner;

  if (symtab->currentScope == NULL)  //  globalObject
    addObject(&(symtab->globalObjectList), obj);
  else {
    switch (obj->kind) {
    case OBJ_VARIABLE:
      obj->varAttrs->scope = symtab->currentScope;
      obj->varAttrs->localOffset = symtab->currentScope->frameSize;
      symtab->currentScope->frameSize += sizeOfType(obj->varAttrs->type);
      break;
    case OBJ_PARAMETER:
      obj->paramAttrs->scope = symtab->currentScope;
      obj->paramAttrs->localOffset = symtab->currentScope->frameSize;
      symtab->currentScope->frameSize ++;
      owner = symtab->currentScope->owner;
      switch (owner->kind) {
      case OBJ_FUNCTION:
	addObject(&(owner->funcAttrs->paramList), obj);
	owner->funcAttrs->paramCount ++;
	break;
      case OBJ_PROCEDURE:
	addObject(&(owner->procAttrs->paramList), obj);
	owner->procAttrs->paramCount ++;
	break;
      default:
	break;
      }
      break;
    case OBJ_FUNCTION:
      obj->funcAttrs->scope->outer = symtab->currentScope;
      break;
    case OBJ_PROCEDURE:
      obj->procAttrs->scope->outer = symtab->currentScope;
      break;
    default: break;
    }
    addObject(&(symtab->currentScope->objList), obj);
  }
  
}
Ejemplo n.º 10
0
void declareObject(Object* obj) {
    // TODO: rewrite the function to fill all values of attributes
    Object *temp;
    if(symtab->currentScope == NULL)
        addObject(&(symtab->globalObjectList),obj);
    else
    {
        if(obj->kind==OBJ_VARIABLE)
        {
            obj->varAttrs->scope=symtab->currentScope;
            obj->varAttrs->localOffset=symtab->currentScope->frameSize;//frameSize se tang khi khai bao them cac bien hoac cac tham so moi

            symtab->currentScope->frameSize+=sizeOfType(obj->varAttrs->type);
        }
        else if(obj->kind == OBJ_PARAMETER)
        {
            obj->paramAttrs->scope=symtab->currentScope;
            obj->paramAttrs->localOffset=symtab->currentScope->frameSize;
            symtab->currentScope->frameSize=(symtab->currentScope->frameSize)+1;
            temp=symtab->currentScope->owner;
            if(temp->kind == OBJ_FUNCTION)
            {
                addObject(&(temp->funcAttrs->paramList),obj);
                temp->funcAttrs->paramCount=temp->funcAttrs->paramCount+1;
            }
            else if(temp->kind==OBJ_PROCEDURE)
            {
                addObject(&(temp->procAttrs->paramList),obj);
                temp->procAttrs->paramCount=temp->procAttrs->paramCount+1;
            }
        }
        else if(obj->kind==OBJ_FUNCTION)
        {
            obj->funcAttrs->scope->outer=symtab->currentScope;
        }
        else if(obj->kind==OBJ_PROCEDURE)
        {
            obj->procAttrs->scope->outer=symtab->currentScope;
        }
        addObject(&(symtab->currentScope->objList),obj);
    }
}
Ejemplo n.º 11
0
/* Return size of the data type. */
int C4SNetSizeof(c4snet_data_t *data)
{ return sizeOfType(data->type); }
Ejemplo n.º 12
0
////////////////////////////////////////////////////////////////////////////////
// size - returns the bytes used for a parameter of this declaration
//
// Parameters:
//   vertices       : Number of vertices (used by vertex class)
//   corners        : Number of corners (used by varying class)
//   facets         : Number of facets (used by uniform class)
//   facevertices   : Number of vertices per face (used by facevertex class)
//   facecorners    : Number of corners per face (used by facevarying class)
//   colorComps     : Number of components per color
//
// Returns:
//   number of bytes
//
int TParameterDeclaration::size(RtInt vertices, RtInt corners, RtInt facets, RtInt faceVertices, RtInt faceCorners, RtInt colorComps) const {
	int n = numElems(vertices, corners, facets, faceVertices, faceCorners);
	if ( m_type == TYPE_COLOR )
		n *= colorComps;
	return n*sizeOfType(m_type);
}
Ejemplo n.º 13
0
void load(char *R, quad *a, qnode *current){
	int n_cur = current->nestingLevel;
	char *sz;
	switch (a->type){
	case QUAD_SE:
		/*Doesnt matter if its Variable or Parameter since its type is in a
		 * struct*/
		if (sizeOfType(a->value.se->u.eVariable.type) == 2)
			sz = "word";
		else if(sizeOfType(a->value.se->u.eVariable.type) == 1)
			sz = "byte";
		/*CHECK THIS HACK LATER*/
		if (a->value.se->nestingLevel == 2) 
			a->value.se->nestingLevel = 3;
		char *sign;
		if(a->value.se->u.eParameter.offset >= 0) sign="+";
		else sign="";
		if(n_cur == a->value.se->nestingLevel)
			if(a->value.se->entryType == ENTRY_PARAMETER &&
				a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				fprintf(fp, "mov\tsi, word ptr [bp%s%d]\n",
				sign,a->value.se->u.eParameter.offset);
				fprintf(fp, "\tmov\t%s, %s ptr [si]\n", R, sz);
			}
			else fprintf(fp, "\tmov\t%s, %s ptr [bp%s%d]\n", R,
				sz, sign ,a->value.se->u.eVariable.offset);
		else 
			if(a->value.se->entryType == ENTRY_PARAMETER && 
				a->value.se->u.eParameter.mode == PASS_BY_REFERENCE){
				getAR(a, current);
				fprintf(fp, "\tmov\tsi, word ptr [si+%d]\n"
				, a->value.se->u.eParameter.offset);
				fprintf(fp, "\tmov\t%s, %s ptr [si]\n", R, sz);
			}
			else {
				getAR(a, current);
				fprintf(fp, "\tmov\t%s, %s ptr [si+%d]\n",
				R, sz, a->value.se->u.eParameter.offset);
			}
		break;
	case QUAD_INTEGER:
		fprintf(fp, "\tmov\t%s, %d\n", R, a->value.intval);
		break;
	case QUAD_CHAR:
		fprintf(fp, "\tmov\t%s, %d\n", R, a->value.intval);
		break;
	case QUAD_BOOL:
		fprintf(fp, "\tmov\t%s, %d\n", R, a->value.intval);
		break;
	/*case QUAD_REAL:
		fprintf(fp, ", %Lf", a->value.floatval);
		break;
	case QUAD_STR:
		fprintf(fp, ", %s", a->value.strval);
		break;
	*/
	case QUAD_POINTER:
		a->type = QUAD_SE;
		load("di", a, current);
		if (sizeOfType(a->value.se->u.eVariable.type->refType) == 2)
			sz = "word";
		else if(sizeOfType(a->value.se->u.eVariable.type->refType) == 1)
			sz = "byte";
		fprintf(fp, "\tmov\t%s, %s ptr[di]\n", R, sz);
		break;
	default:
		break;
	}

}
Ejemplo n.º 14
0
void Quads_to_Assembly(qnode **head, FILE *f) {
		fp = f;
        qnode *temp;
        temp = *head;

		quad *x ;
		quad *y ;
		quad *z ;
		char *MainName;
		MainName = (char *)malloc(246);
			snprintf(MainName, 256, "_%s", main_program->id);

		fprintf(fp, "xseg\tsegment public 'code'\n"
				"\tassume\tcs:xseg, ds:xseg, ss:xseg\n"
				"\torg\t100h\n"
				"main\tproc near\n"
				"\tcall\tnear ptr %s\n"
				"\tmov\tax, 4C00h\n"
				"\tint\t21h\n"
				"main\tendp\n\n", MainName);
		free(MainName);
        if (temp == NULL)
                fprintf(stdout, "\nThe list is empty!\n");
        else {
       		while (temp != NULL) {	
				fprintf(fp, "@%d:\n", temp->n);
				x = temp->x;
				y = temp->y;
				z = temp->z;
		
				switch(temp->op) {
				case OP_UNIT:
				{
					
					char *nm = name(x);
					fprintf(fp, "%s proc near\n"
							"\tpush\tbp\n"
							"\tmov\tbp, sp\n"
							"\tsub\tsp, %d\n", nm, -temp->negOffset);
					free(nm);
					break;
				}
				case OP_ENDU:
				{
					char *end = endof(x->value.se, temp->nestingLevel);
					fprintf(fp, "\tjmp\t%s\n", end);
					char *nm = name(x);
					fprintf(fp, "%s:\n"
								"\tmov\tsp, bp\n"
								"\tpop\tbp\n"
								"\tret\n"
								"%s\tendp\n", end, nm);
					free(nm);
					free(end);
					break;
				}
				case OP_JUMP: 
				{
					char *lbl = label(z);
					fprintf(fp, "\tjmp\t%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_JUMPL:
				{
					char *lbl = label(z);
					fprintf(fp,  "\tjmp\t%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_LABEL:
				{
					char *lbl = label(z);
					free(lbl);
					break;
				}
				case OP_IFB:
				{
					load("al", x,  temp);
					char *lbl = label(z);
					fprintf(fp,  "\tor\tal, al\n"
							"\tjnz\t%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_CALL:
				{
					/*If z is procedure*/
					if (equalType(z->value.se->u.eFunction.resultType, typeVoid))
						fprintf(fp, "\tsub\tsp, 2\n");	
					fprintf(fp, "\tsub\tsp, 2\n");
					/*updateAL(temp, z->value.se);
					*/
					char *nm = name(z);
					fprintf(fp,	"\tcall\tnear ptr %s\n"
							"\tadd\tsp, %d\n", nm, size + 4);	
					free(nm);
					size  = 0;
					break;
				}
				case OP_PAR:
				{
					if (x->type == QUAD_SE) 
						size += sizeOfType(x->value.se->u.eParameter.type);
					else if (x->type == QUAD_POINTER) 
						size += sizeOfType(x->value.se->u.eParameter.type->refType);
					else 
						size += (x->type == QUAD_INTEGER) ?
						(sizeOfType(typeInteger)) : (sizeOfType(typeChar));

					if (y->mode == PASS_BY_VALUE) {
						if (x->type == QUAD_INTEGER || (x->type == QUAD_SE &&
						equalType(x->value.se->u.eParameter.type, typeInteger))) {
							load("ax", x, temp);
							fprintf(fp, "\tpush	ax\n");
						}
						else if (x->type == QUAD_CHAR || x->type == QUAD_BOOL || 
						(x->type == QUAD_SE && 
						(equalType(x->value.se->u.eParameter.type, typeChar) ||
						equalType(x->value.se->u.eParameter.type, typeBoolean)))) {
						load("al", x, temp);
						fprintf(fp, "\tsub\tsp, 1\n"
								"\tmov\tsi, sp\n"
								"\tmov\tbyte ptr [si], al\n");
						} 
						else fprintf(fp, "Error 1");
					}
					else if (y->mode == PASS_BY_REFERENCE || y->mode == RET) {
						loadAddr("si", x, temp);
						fprintf(fp, "\tpush\tsi\n");
					}
					else {
						fprintf(fp, "Error 2\n");
						return;
					}
					break;
				}
				case OP_RET:
				{	
					char *end = endof(temp->inFunction, temp->nestingLevel);
					fprintf(fp, "\tjmp %s\n", end);
					free(end);
					break;
				}
				case OP_RETV:
				{	
					if (x->type == QUAD_INTEGER || (x->type == QUAD_SE &&
						equalType(x->value.se->u.eVariable.type, typeInteger))) {
						fprintf(fp, "\tmov\tsi, word ptr [bp+6]\n");	// Address of result
						load("ax", x, temp);
						fprintf(fp, "\tmov\tword ptr [si], ax\n"); // store it
					}
					else if (x->type == QUAD_CHAR || x->type == QUAD_BOOL || 
						(x->type == QUAD_SE && 
						(equalType(x->value.se->u.eVariable.type, typeChar) ||
						equalType(x->value.se->u.eVariable.type, typeBoolean)))) {
						fprintf(fp, "\tmov\tsi, byte ptr [bp+6]\n");	// Address of result
						load("al", x, temp);
						fprintf(fp, "\tmov\tbyte ptr [si], al\n"); // store it
					}	
					break;
				}
				case OP_eq:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "cmp\tax, dx\n");
					fprintf(fp, "\tje\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_neq:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tcmp\tax, dx\n");
					fprintf(fp, "\tjne\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_less:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tcmp\tax, dx\n");
					fprintf(fp, "\tjl\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_greater:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tcmp\tax, dx\n");
					fprintf(fp, "\tjg\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_leq:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tcmp\tax, dx\n");
					fprintf(fp, "\tjle\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_geq:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tcmp\tax, dx\n");
					fprintf(fp, "\tjge\t");
					char *lbl = label(z);
					fprintf(fp, "%s\n", lbl);
					free(lbl);
					break;
				}
				case OP_PLUS:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tadd\tax, dx\n");
					store("ax", z, temp);
					break;
				}
				case OP_MINUS:
				{
					load("ax", x, temp);
					load("dx", y, temp);
					fprintf(fp, "\tsub\tax, dx\n");
					store("ax", z, temp);
					break;
				}
				case OP_bmul:
				{
					load("ax", x, temp);
					load("cx", y, temp);
					fprintf(fp, "\timul\tcx\n");
					store("ax", z, temp);
					break;
				}
				case OP_bdiv:
				{
					load("ax", x, temp);
					fprintf(fp, "\tcwd\n");
					load("cx", y, temp);
					fprintf(fp, "\tidiv\tcx\n");
					store("ax", z, temp);
					break;
				}
				case OP_bmod:
				{
					load("ax", x, temp);
					fprintf(fp, "cwd\n");
					load("cx", y, temp);
					fprintf(fp, "\tidiv\tcx\n");
					store("dx", z, temp);
					break;
				}
				case OP_mod:
				{
					load("ax", x, temp);
					fprintf(fp, "\tcwd\n");
					load("cx", y, temp);
					fprintf(fp, "\tidiv\tcx\n");
					store("dx", z, temp);
					break;
				}
				case OP_assign:
				{
					/*Fix this*/
					if (x->type == QUAD_SE || x->type == QUAD_POINTER) {
						if (equalType(x->value.se->u.eVariable.type, typeInteger) ||
							equalType(x->value.se->u.eVariable.type, typePointer(typeInteger))) {
							load("ax", x, temp);
							store("ax", z, temp);
						} else if (equalType(x->value.se->u.eVariable.type, typeChar) ||
								   equalType(x->value.se->u.eVariable.type, typePointer(typeChar)) || 
								   equalType(x->value.se->u.eVariable.type, typeBoolean) ||
								   equalType(x->value.se->u.eVariable.type, typePointer(typeBoolean))) {
							load("al", x, temp);
							store("al", z, temp);
						}
					}
					else if (x->type == QUAD_INTEGER) {
						load("ax", x, temp);
						store("ax", z, temp);
					}	
					else if (x->type == QUAD_CHAR || x->type == QUAD_BOOL) {
						load("al", x, temp);
						store("al", z, temp);
					}
					break;
				}
				case OP_ARRAY:
				{
					load("ax", y, temp);
					fprintf(fp, "\tmov\tcx, %d\n"
							"\timul	cx\n", size);
					loadAddr("cx", x, temp);
					fprintf(fp, "\tadd\tax, cx\n");
					store("ax", z, temp);
					break;
				}
				default:
					fprintf(fp, "For debugging\n");
					break;
				}
				temp = temp->next;
			}
        }
		fprintf(fp, //"extrn\t_putchar:proc\n"
					//"extrn\t_puts:proc\n"
					"extrn\t_writeInteger:proc\n"
					"extrn\t_writeBoolean:proc\n"
					"extrn\t_writeChar:proc\n"
					"extrn\t_writeReal:proc\n"
					"extrn\t_writeString:proc\n"
					"extrn\t_READ_INT:proc\n"
					"extrn\t_READ_BOOL:proc\n"
					"extrn\t_READ_CHAR:proc\n"
					"extrn\t_READ_REAL:proc\n"
					"extrn\t_READ_STRING:proc\n"
					"extrn\t_abs:proc\n"
					"extrn\t_fabs:proc\n"
					"extrn\t_sqrt:proc\n"
					"extrn\t_sin:proc\n"
					"extrn\t_cos:proc\n"
					"extrn\t_tan:proc\n"
					"extrn\t_arctan:proc\n"
					"extrn\t_exp:proc\n"
					"extrn\t_ln:proc\n"
					"extrn\t_pi:proc\n"
					"extrn\t_trunc:proc\n"
					"extrn\t_round:proc\n"
					"extrn\t_TRUNC:proc\n"
					"extrn\t_ROUND:proc\n"
					//"extrn\t_strlen:proc\n"
					//"extrn\t_strcmp:proc\n"
					//"extrn\t_strcpy:proc\n"
					//"extrn\t_strcat:proc\n"
					);

		print_strings(fp, head_str);

		fprintf(fp, "xseg ends\n"
					"\tend\tmain\n");
		}