From cmcl2!yale!think.com!spool2.mu.edu!uunet!panews.awdpa.ibm.com!bullhead!brunner Tue Jan 15 14:05:57 EST 1991
Article 2449 of comp.sys.ibm.pc.rt:
Path: cmcl2!yale!think.com!spool2.mu.edu!uunet!panews.awdpa.ibm.com!bullhead!brunner
>From: brunner@bullhead.uucp
Newsgroups: comp.sys.ibm.pc.rt
Subject: Pragmas and Extensions supported in hc2.1y (Was: Re: HC 2)
Message-ID: <1991Jan15.002628.9608@panews>
Date: 15 Jan 91 00:26:28 GMT
References: <1990Dec19.140919.4497@athena.mit.edu>
Sender: news@panews (news id)
Reply-To: brunner@ibmsupt.UUCP ()
Organization: IBM AWD Palo Alto
Lines: 102

Just before the winter break John Carr posted asking for a list of all the
supported pragma directives and extensions to the C language available in
the now-final version of the Metaware High C compiler. I promised to ask
Mimi Vo and to forward to the newsgroup her response. Here is her list with
John's original questions and comments interposed.

=== begin ===

	> Is there a list of what all the supported pragma directives are?  I've
	> figured out some by running "strings" on the binary, but it's not
	> always clear from the name what the pragma does or how it is used.
	> 

The following pragmas are available:
Name		Purpose
----		-------
On, Off, Pop	Turns On or Off, or reinstates a prior status of a compiler
		switch
Alias		Specifies the external name to be associated w/ a global
		identifier
Code		Specifies the section into which generated code is to be placed
Data		Specifies the section into which data storage is to be allocated
Include		Includes the source of another file in the compilation unit
C_include	Conditional form of include
R_include	Includes the source of another file in the compilation unit,
		treating the path name as Relative to the directory of the file 
		containing the pragma
RC_include	Conditional form of R_include
Page		Causes page ejects to be inserted into the listing
Skip 		Causes blank lines to be inserted into the listing
Title		Causes a title to appear at the top of each subsequent page

	> hc also supports a number of extensions to the C language.  It has a
	> few extra keywords.  For example, function definitions can be declared
	> "_Inline".  This suggests that hc will inline functions, but it
	> doesn't seem to affect code generation.  There are also keywords
	> "_Bound" and "_CC", which are sometimes inserted by error recovery but
	> don't seem to be legal otherwise.  Do any of these do anything?
	> 
	> I know that hc recognizes certain function names and inlines them; is
	> there a list of recognized functions?

First of all, I don't know what is "_CC" is supposed to do, I could not find any
document on it anywhere and never heard MetaWare said anything about it.

About "_Bound" and "_Unbound" keywords, these only relevant if you are running
HC on PS2 AIX that support TOC (Table of Contents) shared libraries.  For most
of our customer, they don't need them.

Finally, the inliner.  You may specify particular routines to be inlined by the
command line "-Hi" option, and also allow the inliner to select automatically 
routines that satify adjustable criteria, such as the number of calls and the
size of the routine.  But unless other options below are designated or functions
have been specifically designated as inline functions (using the type qualifier
_Inline, as in _Inline void f() {...}, to cause f to be inlined), nothing else
will be inlined.

Here are the options:
	-Hit=n		causes funcs with less than n tree nodes to be inlined
	-Hic=n		causes funcs called less than n times to be inlined
	-Hir		suppress inlining of recursive functions
	-Hix		suppress inlining of exported functions
	-Hin		suppress inlining of nested functions
	-Hia		suppress inlining of functions that have their address
			taken
	-Hih		print history of which functions are inlined or cloned
	-Hib=n		designate tmpfile buffer size (default is 65536)

Here is the list of intrinsic functions which are always inlined:
	_abs(x)		
	_max(e1,e2,..)
	_min(e1,e2,..)
	_find_char(any_pointer p, unsigned search_length, char search_char)
	_skip_char(any_pointer p, unsigned search_length, char search_char)
	_fill_char(any_pointer p, unsigned len, char fill)
	_move(any_pointer from, any_pointer to, unsigned len)
	_move_right(any_pointer from, any_pointer to, unsigned len)
	_compare(any_pointer p1, any_pointer p2, unsigned len)
	_offsetof(any_structure_type, any_field_name)
	   or
	_offsetof(any_expression_of_a_structure_type, any_field_name)
	
Also library functions:
	memcpy, strcpy, and alloca
and transcedental math functions (may not be applied to RT)
	sin, cos, arcsin, arccos, sqrt, ln, log10, exp, tan, arctan, arctan2,
	sinh, cosh, tanh, and fabs
	==> if the target machine does not support such instructions, inline
	code will not be generated.

To turn off inlining fo library functions and transcedentals, us the toggle:
	-Hoff=Recognize_library
	
=== end ===

That's all, let me know if we've missed anything. Let me know too if we've
botched anything!

#include <std/disclaimer.h>
Eric Brunner, Consultant, IBM AWD Palo Alto	(415) 855-4486
inet: brunner@monet.berkeley.edu		uucp: uunet!ibmsupt!brunner
trying to understand multiprocessing is like having bees live inside your head.


