Implemented builtin functions
[fw/sdcc] / src / z80 / main.c
index 8db371fdcfbfedabf41687dfeacf563f72bfdf40..8622ae90a9291e367df25aa93484fb954b4009c9 100644 (file)
@@ -320,6 +320,7 @@ _setDefaultOptions (void)
   options.mainreturn = 1;
   /* first the options part */
   options.intlong_rent = 1;
+  options.float_rent = 1;
   options.noRegParams = 1;
   /* Default code and data locations. */
   options.code_loc = 0x200;
@@ -386,6 +387,40 @@ _getRegName (struct regs *reg)
   return "err";
 }
 
+static bool
+_hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
+{
+  sym_link *test = NULL;
+  value *val;
+
+  if ( ic->op != '*')
+    {
+      return FALSE;
+    }
+
+  if ( IS_LITERAL (left))
+    {
+      test = left;
+      val = OP_VALUE (IC_LEFT (ic));
+    }
+  else if ( IS_LITERAL (right))
+    {
+      test = left;
+      val = OP_VALUE (IC_RIGHT (ic));
+    }
+  else
+    {
+      return FALSE;
+    }
+
+  if ( getSize (test) <= 2)
+    {
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 #define LINKCMD \
     "{bindir}{sep}link-{port} -n -c -- {z80bases} -m -j" \
     " {z80libspec}" \
@@ -468,6 +503,7 @@ PORT z80_port =
   _reg_parm,
   _process_pragma,
   _mangleSupportFunctionName,
+  _hasNativeMulFor,
   TRUE,
   0,                           /* leave lt */
   0,                           /* leave gt */
@@ -476,6 +512,8 @@ PORT z80_port =
   1,                           /* transform != to !(a == b) */
   0,                           /* leave == */
   TRUE,                         /* Array initializer support. */       
+  0,                            /* no CSE cost estimation yet */
+  NULL,                        /* no builtin functions */
   PORT_MAGIC
 };
 
@@ -549,6 +587,7 @@ PORT gbz80_port =
   _reg_parm,
   _process_pragma,
   _mangleSupportFunctionName,
+  _hasNativeMulFor,
   TRUE,
   0,                           /* leave lt */
   0,                           /* leave gt */
@@ -556,6 +595,8 @@ PORT gbz80_port =
   1,                           /* transform >= to ! < */
   1,                           /* transform != to !(a == b) */
   0,                           /* leave == */
-  FALSE,                        /* No array initializer support. */
+  TRUE,                         /* Array initializer support. */
+  0,                            /* no CSE cost estimation yet */
+  NULL,                        /* no builtin functions */
   PORT_MAGIC
 };