X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=doc%2FSDCCUdoc-19.html;h=8c23bdeecb149f5fec9a4a05e00d0d82c9f5bb0f;hb=43937f3c34fef0d918482f2d5646f55f21e0de70;hp=2f8614b4f68709fbff21b57caf66d88e887666ac;hpb=b09af35f2f1cde7649d3ac4a6f5d2af6d97895a0;p=fw%2Fsdcc diff --git a/doc/SDCCUdoc-19.html b/doc/SDCCUdoc-19.html index 2f8614b4..8c23bdee 100644 --- a/doc/SDCCUdoc-19.html +++ b/doc/SDCCUdoc-19.html @@ -1,8 +1,8 @@ - - SDCC Compiler User Guide: Library routines. + + SDCC Compiler User Guide: Pragmas @@ -12,84 +12,81 @@ Previous Contents
-

19. Library routines.

+

19. Pragmas

-

The following library routines are provided for your convenience. -

stdio.h - Contains the following functions printf & sprintf these routines -are developed by Martijn van Balen <balen@natlab.research.philips.com>. +

SDCC supports the following #pragma directives. This directives are +applicable only at a function level.

+

+

The pragma's are intended to be used to turn-off certain optimizations +which might cause the compiler to generate extra stack / data space to store +compiler generated temporary variables. This usually happens in large functions. +Pragma directives should be used as shown in the following example, they are +used to control options & optimizations for a given function; pragmas should +be placed before and/or after a function, placing pragma's inside a function +body could have unpredictable results.

-%[flags][width][b|B|l|L]type           flags: -        left justify output in specified field width
- 
-                 +        prefix output with +/- sign if output is signed
- type 
-                 space    prefix output with a blank if it's a signed
- positive value 
-          width:          specifies minimum number of characters
- outputted for numbers 
-                          or strings. 
-                         
- - For numbers, spaces are added on the left when needed. 
-                           
- If width starts with a zero character, zeroes and used 
-                           
- instead of spaces. 
-                          - For strings, spaces are are
- added on the left or right (when 
-                            flag '-' is used)
- when needed. 
-                          
-          b/B:            byte argument
- (used by d, u, o, x, X) 
-          l/L:            long argument (used by d,
- u, o, x, X)
-          type:  d        decimal number 
-                 u       
- unsigned decimal number 
-                 o        unsigned octal number 
-                
- x        unsigned hexadecimal number (0-9, a-f) 
-                 X       
- unsigned hexadecimal number (0-9, A-F) 
-                 c        character
- 
-                 s        string (generic pointer) 
-                 p       
- generic pointer (I:data/idata, C:code, X:xdata, P:paged) 
-                
- f        float (still to be implemented)
- 
-
-

Also contains a very simple version of printf (printf_small). This simplified -version of printf supports only the following formats. -

-

-format     output type     argument-type <bf>
-%d         decimal      
- int 
-%ld        decimal       long 
-%hd        decimal       short/char
- 
-%x        hexadecimal    int 
-%lx       hexadecimal    long
- 
-%hx       hexadecimal    short/char 
-%o         octal         int
- 
-%lo        octal         long 
-%ho        octal         short/char
- 
-%c        character      char/short 
-%s        character     _generic
- pointer
- <p><tt>The routine is <tt><bf>very stack intesive , --stack-after-data parameter should
- be used when using this routine, the routine also takes about 1K of code space
- .It also expects an external function named putchar(char ) to be present (this
- can be changed). When using the %s format the string / pointer should
- be cast to a generic pointer. eg.
+eg#pragma SAVE   /* save the current settings */ 
+#pragma NOGCSE
+ /* turnoff global subexpression elimination */ 
+#pragma NOINDUCTION /*
+ turn off induction optimizations */ 
+int foo () 
+{ 
+    ... 
+    /* large
+ code */ 
+    ... 
+} 
+#pragma RESTORE /* turn the optimizations back
+ on */
  
 
+

The compiler will generate a warning message when extra space is allocated. +It is strongly recommended that the SAVE and RESTORE pragma's be used when +changing options for a function.


Next Previous