Netra Data Plane Software Suite 2.0 User’s Guide
|
|
This chapter discusses some of the basic aspects of the tejacc compiler. Topics include:
Command-Line Options
The tejacc command-line syntax is as follows:
tejacc common_options [-srcset name srcset_options source_files]+
where:
- common_options are the options that apply to tejacc or options that apply to all source files.
- name is the name of the source set.
- srcset_options are the options that are applied only to the source set.
- source_files are the files used to create the source set.
-srcset creates a source set that can be mapped to one or more processes. Additionally, one or more source sets can be created.
tejacc Command-Line Options
TABLE 2-1 tejacc Options
Option
|
Description
|
-hwarch hwarch_lib,hwarch_function
|
The hwarch_function from the dynamic shared library hwarch_lib is executed to create a memory model of the target hardware architecture representation on which the generated application is run. There are no default values for this option, so options are mandatory.
|
-swarch swarch_lib,swarch_function
|
The swarch_function from the dynamic shared library swarch_lib is executed to create a memory model of the target software architecture representation on which the generated application is mapped. There are no default values for this option, so options are mandatory.
|
-map map_lib,map_function
|
The map_function from the dynamic shared library map_lib is executed to create a mapping between the user application, software architecture, and hardware architecture. There are no default values for this option, so options are mandatory.
|
-D name[=definition]
|
Redefines name as a macro, with definition or 1 if not specified. This option is applied to the preprocessing stage of the compilation.
|
-include includefile
|
Processes includefile as if #include “file” appeared as the first line of the primary source file.
|
-I includedir
|
Adds the directory includedir to the head of the list of directories to be searched for header files.
|
-E
|
Prints preprocessed output to the stdout and stops any further processing.
|
-w
|
Suppresses all warnings.
|
-d destdir
|
Specifies the destination directory for the generated code. The default value is the current_dir /code.
|
-O
|
Enables optimizations. All applicable optimizations are used for code generation.
|
-fcontext-sensitive-generation
|
Enables context-sensitive code generation optimization. The generated Late-Binding API implementation has separate implementations for every context and enables inlining through the target compiler.
|
-pg
|
Enables profiling. Calling the profiling API in the source files generates target-specific code to enable profiling and collect data. If the -pg option is not specified, the profiling API is not called.
|
-h, ?h, -help, ?help
|
Prints tejacc usage.
|
-srcset srcset_namesrcset_specific_optionssource_files
|
Defines a source set consisting of one or more source files. The source set is used to map to one or more processes. srcset_specific_options are applied only to the files listed in the source_files. The -D, -I and -include options are also part of the source set specific options.
|
-finline=comma separated list of functions
|
This option is only applicable to the source set and tries to inline the functions that are specified in the list. There are no errors or warnings if a listed function is not found in the sources.
|
Optimization Optimization Options
You can use the following command-line switches to tejacc to enable optimization:
- -O - enables all optimizations
- -fcontext-sensitive-generation - enables context sensitive generation only
TABLE 2-2 lists the available optimizations for the tejacc compiler.
TABLE 2-2 Optimizations for tejacc
Optimization
|
Comment
|
Context-sensitive generation
|
Affects all late-binding functions. See Late-Binding Elements. These functions are generated from context information such as constant parameters known to the compiler and global information from software architecture, hardware architecture, and mapping.
|
Global inlining
|
Functions marked with the inline keyword get inlined throughout the entire application, including across files.
|
Reachability
|
Unused functions and variables are not generated, saving code space.
|
Target compiler optimizations
|
--
|
Context-Sensitive Generation
All late-binding APIs and profiler APIs benefit from context-sensitive generation.
To Enable Optimization
|
1. Add the appropriate switch to the tejacc command line.
Refer to Optimization Options.
2. Use constants in late-binding calls that you want to optimize.
- For channel, mutex, queue, and memory pool functions, ensure that the late-binding object you are passing is constant. You can increase the performance for channels with a circular buffer-based implementation. When you use a fixed and constant message size (1, 2, 4, or 8) for all teja_channel_send calls on a given circular buffer based channel c, the code generator detects the condition and uses a unique and very fast implementation of the buffer.
- For teja_wait, ensure that the four parameters specifying a time quantity are constant and that any channels passed are constant.
If these two conditions are not met for a given function call, that function call is generated without context-sensitive optimization.
LanguageLanguage Characteristics
The tejacc compiler front-end parses a subset of extended C as defined by gcc. However, there are some limitations:
- The compiler does not parse K and R syntax for function declaration.
- tejacc does not assign integer types to variables by default.
- The compiler does not support undeclared functions and does not default to type int.
- tejacc implements strict type checking, and might return warnings or errors in the situation of a type mismatch.
- Though the tejacc compiler recognizes a subset of extended C, for interoperability, the compiler supports the language that is used by the target complier.
Include Files
For each user source file, the teja_include_all.h file is always included before any other include or C code is preprocessed. The teja_include_all.h file is located in the include/runtime/target_processor_name/target_os_name directory. This directory also contains other target-dependent include files.
Late-Binding Object Identifiers
Late-binding objects such as channels, memory pools, queues, and mutexes are created in the software architecture. The Late-Binding API described in the file teja_late_binding.h provides operations on these objects and is called inside the user application source code.
The mechanism to access late-binding objects in the user application code is to use them as C preprocessor symbols that have the same names as the strings that were used to create the late-binding objects in the software architecture. The tejacc compiler creates a set of defines for these late-binding object identifiers and passes them to the command-line during the compilation.
The list of C preprocessor symbols are generated in the reports/process_name_predefined_symbols.h file.
Netra Data Plane Software Suite 2.0 User’s Guide
|
820-3362-10
|
|
Copyright © 2008, Sun Microsystems, Inc. All Rights Reserved.