Next:  Writing Efficient Code
Up:  The Compiler
 Previous:  Mode Declarations
 
 
 
Compiler pragmas are compiler directives which instruct the compiler
to emit a particular code type.
Their syntax is similar to directives:
 :- pragma(Option).
It is not possible to have several pragmas grouped together and separated
by commas like goals, every pragma must be specified separately.
 Option can be one of the following:
-   debug - generate code which can be inspected with the
debugger, similarly to setting the global flag  debug_compile to  on.
It also implies the  noexpand pragma.
 -   nodebug - generate optimized code with no debugger support,
similarly to setting the global flag  debug_compile to  off.
It also implies the  expand pragma.
 -   silent_debug - generate code which cannot be inspected
by the debugger, but which allows to debug predicates called
by it.
This is similar to setting the  leash flag
of all subgoals in the following clauses
to  notrace.
This option is useful e.g. for library predicates which call other
Prolog predicates: the user wants to see in the debugger the
call to the library predicate and to the invoked predicate,
but no internal calls in the library predicates.
 -   expand - do in-line expansion of some subgoals,
like =/2,  is/2 and others.
This code can still be inspected with the debugger but the expanded
subgoals look differently than in the normal debugged code,
or their arguments cannot be seen.
In-line expansion is also done when the global flag  debug_compile
is  off, or when the pragma  nodebug is specified.
 -   noexpand - inhibit the in-line goal expansion.
This is also done in the pragma  debug.
 -   skip - set the  skip flag of all following
predicates to  on.
 -   noskip - set the  skip flag of all following
predicates to  off.
 -   system - set the  type flag of all following
predicates to  built_in.
Moreover, all following predicates will have unspecified
 source_file and  source_line flags.
 
By default, the compiler works as if the pragmas  debug,  noexpand
and  noskip were specified.
The pragma is active from its specification in the file
until the file end or until it is disabled by another pragma.
Recursive compilations or calls to other compiling predicates
are not affected by the pragma.
Pragmas which have the same effect as global flags override
the global flags if they specify more optimized code.
For instance, the pragma  debug has no effect if the
global flag  debug_compile is  off,
but the pragma  nodebug overrides the global
flag  debug_compile being  on.
The pragmas are  useful mainly for libraries and other programs
that should be always compiled in a particular mode
independently of the global flags setting.
 
   
   
      
   
 Next:  Writing Efficient Code
Up:  The Compiler
 Previous:  Mode Declarations
 
 
 
Micha Meier 
Mon Mar  4 12:11:45 MET 1996