]> git.gag.com Git - fw/sdcc/commitdiff
* device/lib/printf_large.c: removed inline assembly for portability and
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 15 Mar 2005 07:34:20 +0000 (07:34 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 15 Mar 2005 07:34:20 +0000 (07:34 +0000)
  readability. Use printf_fast if speed or size are more important.
* src/pic16/gen.c: removed conditions around use of DEBUGpc
* src/pic16/genutils.h: added define for DEBUGpc for MSVC

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3696 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/printf_large.c
src/pic16/gen.c
src/pic16/genutils.h

index d5cacd965b9538bd7d9f58ee9532e67193b0ea06..9f4e7af7351a9936e493f6c6392bf8cc35e9a7df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-15 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * device/lib/printf_large.c: removed inline assembly for portability and
+         readability. Use printf_fast if speed or size are more important.
+       * src/pic16/gen.c: removed conditions around use of DEBUGpc
+       * src/pic16/genutils.h: added define for DEBUGpc for MSVC
+
 2005-03-15 Vangelis Rokas <vrokas AT users.sourceforge.net>
 
        * src/pic16/genutils.c (pic16_genCmp_special): initialized offs to
@@ -84,7 +91,7 @@
        * src/pic16/gen.c (pic16_loadFSR0, genPackBits, genUnpackBits,
          genNearPointerGet): (hopefully) fixed access to bitfields via
          pointers (p->bitN = x; and x = p->bitN; failed)
-       
+
 2005-03-09 Paul Stoffregen <paul AT pjrc.com>
 
        * device/lib/printf_fast.c: fix leading zero format, eg "%02d"
index b5cfb5e7a07cbb32b51dfb7b7bc3027778c653e7..1dfb9bd6d2237aeeaf8ce368b262f51c28096955 100644 (file)
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
-#ifdef SDCC_STACK_AUTO
-  #ifdef ASM_ALLOWED
-    /* Eventually we should get rid of ASM_ALLOWED completely as it   */
-    /* prevents portability, clobbers this source and brings only 2%  */
-    /* optimization. A better alternative is a completely handcrafted */
-    /* asm version if needed. */
-    #undef ASM_ALLOWED
-  #endif
-#endif
-
 #if defined(__ds390)
 #define USE_FLOATS 1
 #endif
@@ -79,15 +69,7 @@ static const char memory_id[] = "IXCP-";
   static BOOL lower_case;
   static pfn_outputchar output_char;
   static void* p;
-
-  #ifdef ASM_ALLOWED
-    static bool   lsd;
-
-    /* this one NEEDS to be in data */
-    static data value_t value;
-  #else
-    static value_t value;
-  #endif
+  static value_t value;
 #endif
 
 /****************************************************************************/
@@ -122,39 +104,7 @@ static const char memory_id[] = "IXCP-";
 
 /*--------------------------------------------------------------------------*/
 
-#if defined ASM_ALLOWED
-static void calculate_digit( unsigned char radix )
-{
-  unsigned char i;
-
-  for( i = 32; i != 0; i-- )
-  {
-_asm
-  clr  c
-  mov  a,_value+0
-  rlc  a
-  mov  _value+0,a
-  mov  a,_value+1
-  rlc  a
-  mov  _value+1,a
-  mov  a,_value+2
-  rlc  a
-  mov  _value+2,a
-  mov  a,_value+3
-  rlc  a
-  mov  _value+3,a
-  mov  a,_value+4
-  rlc  a
-  mov  _value+4,a
-_endasm;
-    if (radix <= value.byte[4] )
-    {
-      value.byte[4] -= radix;
-      value.byte[0]++;
-    }
-  }
-}
-#elif defined SDCC_STACK_AUTO
+#if defined SDCC_STACK_AUTO
 static void calculate_digit( value_t* value, unsigned char radix )
 {
   unsigned char i;
@@ -400,9 +350,7 @@ int _print_format (pfn_outputchar pfn, void* pvoid, const char *format, va_list
   BOOL   lower_case;
   value_t value;
 #endif
-#ifndef ASM_ALLOWED
   BOOL   lsd;
-#endif
 
   unsigned char radix;
   int charsOutputted;
@@ -623,10 +571,8 @@ get_conversion_spec:
       {
         // Apperently we have to output an integral type
         // with radix "radix"
-#ifndef ASM_ALLOWED
         unsigned char store[6];
         unsigned char _AUTOMEM *pstore = &store[5];
-#endif
 
         // store value in byte[0] (LSB) ... byte[3] (MSB)
         if (char_argument)
@@ -668,21 +614,6 @@ get_conversion_spec:
 #else
           calculate_digit(radix);
 #endif
-#if defined ASM_ALLOWED
-_asm
-  jb   _lsd,1$
-  pop  b                ; b = <lsd>
-  mov  a,_value+4       ; a = <msd>
-  swap a
-  orl  b,a              ; b = <msd><lsd>
-  push b
-  sjmp 2$
-1$:
-  mov  a,_value+4       ; a = <lsd>
-  push acc
-2$:
-_endasm;
-#else
           if (!lsd)
           {
             *pstore = (value.byte[4] << 4) | (value.byte[4] >> 4) | *pstore;
@@ -692,7 +623,6 @@ _endasm;
           {
             *pstore = value.byte[4];
           }
-#endif
           length++;
           lsd = !lsd;
         } while( value.ul );
@@ -762,22 +692,6 @@ _endasm;
         while( length-- )
         {
           lsd = !lsd;
-#ifdef ASM_ALLOWED
-_asm
-  jb   _lsd,3$
-  pop  acc              ; a = <msd><lsd>
-  nop                   ; to disable the "optimizer"
-  push acc
-  swap a
-  anl  a,#0x0F          ; a = <msd>
-  sjmp 4$
-3$:
-  pop  acc
-  anl  a,#0x0F          ; a = <lsd>
-4$:
-  mov  _value+4,a
-_endasm;
-#else
           if (!lsd)
           {
             pstore++;
@@ -787,7 +701,6 @@ _endasm;
           {
             value.byte[4] = *pstore & 0x0F;
           }
-#endif
 #ifdef SDCC_STACK_AUTO
           output_digit( value.byte[4], lower_case, output_char, p );
 #else
index 41b5a82a15b1790c932c2c2cbee6c304a36ef8d1..aa092a06e6b7669a9a2ef64a0f5cda6e3925c602 100644 (file)
@@ -5026,9 +5026,7 @@ static void genCmp (operand *left,operand *right,
    * make sure that left is register (or the like) *
    *************************************************/
   if (!isAOP_REGlike(left)) {
-    #if !defined(__BORLANDC__) && !defined(_MSC_VER)
     DEBUGpc ("swapping arguments (AOP_TYPEs %d/%d)", AOP_TYPE(left), AOP_TYPE(right));
-    #endif
     assert (isAOP_LIT(left));
     assert (isAOP_REGlike(right));
     // swap left and right
@@ -5064,9 +5062,7 @@ static void genCmp (operand *left,operand *right,
   if (isAOP_LIT(right)) {
     if (!sign) {
       // unsigned comparison to a literal
-      #if !defined(__BORLANDC__) && !defined(_MSC_VER)
       DEBUGpc ("unsigned compare: left %s lit(0x%X=%lu), size=%d", performedLt ? "<" : ">=", lit, lit, size+1);
-      #endif
       if (lit == 0) {
        // unsigned left < 0? always false
        if (performedLt) emitCLRC; else emitSETC;
@@ -5074,9 +5070,7 @@ static void genCmp (operand *left,operand *right,
       }
     } else {
       // signed comparison to a literal
-      #if !defined(__BORLANDC__) && !defined(_MSC_VER)
       DEBUGpc ("signed compare: left %s lit(0x%X=%ld), size=%d, mask=%x", performedLt ? "<" : ">=", lit, lit, size+1, mask);
-      #endif
       if ((lit & mask) == ((0x80 << (size*8)) & mask)) {
        // signed left < 0x80000000? always false
        if (performedLt) emitCLRC; else emitSETC;
index 2ada0772e952793f0d9b098346ac7be42073765d..187bda36433935e2c56e5e52539662bf4041d1a7 100644 (file)
@@ -12,6 +12,8 @@
 
 #if !defined(__BORLANDC__) && !defined(_MSC_VER)
 #define DEBUGpc(fmt,...)  DEBUGpic16_emitcode("; =:=", "%s:%s:%d: " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define DEBUGpc           1 ? (void)0 : printf
 #endif
 #define isAOP_LIT(x)      (AOP_TYPE(x) == AOP_LIT)
 #define isAOP_REGlike(x)  (AOP_TYPE(x) == AOP_REG || AOP_TYPE(x) == AOP_DIR || AOP_TYPE(x) == AOP_PCODE || AOP_TYPE(x) == AOP_STA)