예제 #1
0
/*-----------------------------------------------------------------*/
static void 
convertToFcall (eBBlock ** ebbs, int count)
{
  int i;

  /* for all blocks do */
  for (i = 0; i < count; i++)
    {
      iCode *ic;

      /* for all instructions in the block do */
      for (ic = ebbs[i]->sch; ic; ic = ic->next)
	{

	  /* floating point operations are
	     converted to function calls */
	  if ((IS_CONDITIONAL (ic) ||
	       IS_ARITHMETIC_OP (ic)) &&
	      (IS_FLOAT (operandType (IC_RIGHT (ic)))))
	    {

	      cnvToFcall (ic, ebbs[i]);
	    }

	  /* casting is a little different */
	  if (ic->op == CAST)
	    {
	      if (IS_FLOAT (operandType (IC_RIGHT (ic))))
		cnvFromFloatCast (ic, ebbs[i]);
	      else if (IS_FLOAT (operandType (IC_LEFT (ic))))
		cnvToFloatCast (ic, ebbs[i]);
	    }

	  /* if long / int mult or divide or mod */
	  if (ic->op == '*' || ic->op == '/' || ic->op == '%')
	    {
	      sym_link *leftType = operandType (IC_LEFT (ic));

	      if (IS_INTEGRAL (leftType) && getSize (leftType) > port->support.muldiv)
                {
                  sym_link *rightType = operandType (IC_RIGHT (ic));

                  if (port->hasNativeMulFor != NULL &&
                      port->hasNativeMulFor (ic, leftType, rightType))
                    {
                      /* Leave as native */
                    }
                  else
                    {
                      convilong (ic, ebbs[i], leftType, ic->op);
                    }
                }
	    }
          
          if (ic->op == RRC || ic->op == RLC || ic->op == LEFT_OP || ic->op == RIGHT_OP)
            {
	      sym_link *type = operandType (IC_LEFT (ic));

	      if (IS_INTEGRAL (type) && getSize (type) > port->support.shift && port->support.shift >= 0)
                {
                  convilong (ic, ebbs[i], type, ic->op);
                }
            }
	}
    }
}
예제 #2
0
/**
 * Hex-based serializing
 */
#ifndef H_BOOST_EXT_SERIALIZERS_HEXICAL
#define H_BOOST_EXT_SERIALIZERS_HEXICAL

#include "boost-ext/hexical_cast.hpp"
#include "boost-ext/serializer.hpp"

namespace boost_ext {

    /** Create hexical converters and serializer - do it here since serializer depends on hexical_cast */
    DEFINE_BASE_CONVERTER(hexical_converter)
    DEFINE_DBL_CONVERTER_IF((IS_INTEGRAL((V))), (typename V), hexical_converter, (V), (std::string), v, (
        return hexical_cast<std::string>(v);
    ), (
        if (boost::istarts_with(v, "0x")) {
            return hexical_cast<V>(v);
        } else {
            return boost::numeric_cast<V>(boost::lexical_cast<uintmax_t>(v));
        }
    ))
    DEFINE_DBL_SERIALIZER(hexical_converter, hexical_serializer, hexical_deserializer)

} /* namespace boost_ext */
#endif /* H_BOOST_EXT_SERIALIZERS_HEXICAL */


/** Only register them as a default if we haven't yet, and if we aren't explicitly skipping them */
#if !defined(H_BOOST_EXT_SERIALIZERS_HEXICAL_DEFAULT) && !defined(SKIP_DEFAULT_SERIALIZERS)
#define H_BOOST_EXT_SERIALIZERS_HEXICAL_DEFAULT