C H A P T E R  2

tejacc Basics

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:

-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:

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.


procedure icon  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.

If these two conditions are not met for a given function call, that function call is generated without context-sensitive optimization.


Language

Language Characteristics

The tejacc compiler front-end parses a subset of extended C as defined by gcc. However, there are some limitations:

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.