Lcc что это
Перейти к содержимому

Lcc что это

  • автор:

Lcc что это

Dave Hanson and Chris Fraser

LCC (акроним от «Local C Compiler» или «Little C Compiler») — Небольшой адаптируемый ANSI C компилятор, имеющий лицензию, которая запрещает его коммерческое распространение [1] [2] и требует покупки лицензии для любого коммерческого использования. Позволяет быстро сгенерировать код для платформ DEC Alpha, SPARC, MIPS R3000, x86, SGI N32, а также для платформы .Net.

Реализация описана в книге A Retargetable C Compiler: Design and Implementation (ISBN 0-8053-1670-1).

Исходный код компилятора LCC часто используют, когда требуется компиляция с языка, близкого к Си на ту или иную платформу (например, в байт-код виртуальной машины). Именно так использован LCC в Quake III (см. QuakeC).

LCC-Win32

Компилятор и IDE LCC-Win32 в настоящее время развивается немецкой фирмой Q Software Solution как коммерческое ПО, бесплатное для персонального использования. Ею так же разработаны LCC-Win64 и lcc-linux32.

Входной язык LCC-Win32 — это версия Си, расширенная некоторыми возможностями, характерными для С++, такими как перегрузка операций, (ограниченная) перегрузка функций, декларация переменных в любом месте блока, подставляемые (inline) функции, работа с исключениями. Однако синтаксис и семантика этих расширений отличаются от принятых в C++.

Ссылки

Официальные сайты

  • LCC (англ.)
  • LCC-Win32 (англ.)
  • LCC для SGI N32 (англ.)

Информационные ресурсы

  • Статья lcc-win32 в Прогопедии — энциклопедии языков программирования (рус.)
  • Программное обеспечение по алфавиту
  • Компиляторы C

Getting started

This section provides a getting started guide on the LCC compiler. For a slightly more detailed discussion on how to use the LCC compiler see the next section.

Step 1

Open a bash-shell by double-clicking on the bash icon on you desktop.

Step 2

Set the LCCDIR variabele in the environment to the directory containing the LCC executable. Do this using the following command:

export LCCDIR=/cygdrive/D/mmips/lcc/lccdir
Step 3

Add the LCC-directory to you path using the following command:

PATH=$LCCDIR:$PATH
Step 4

Change to the installation directory of the course software (i.e. ). This is typically ‘d:\mmips\’, however within cygwin we write this different. To revert to this directory, you should use the following command:

cd /cygdrive/D/mmips
cd d:/mmips
Step 5

Change to the directory in which the source of our test program ‘apps/example’.

cd apps/example

The file ‘main.c’ contains our simple test program. Its contents is shown below.
void main(void)

Step 6

We are now ready to compile (and link) the source into an executable binary for our miniMIPS processor. This can be done with the following command:

lcc main.c -o main

We now get a binary called ‘main’ that contains the binary code of our program.

Step 7

If you want, you can dissamble the binary and look at the assembler instruction. The can be done with a tool called ‘disas’. You use it with the following command:

disas main

The output of the program looks as follows on your screen:

The complete disassembly of the program is shown below. Try to understand what happens!

main: file format binary Disassembly of section .data: 0000000000000000 : 0: 00000000 nop # Start of boot-loader 4: 0c000005 jal 0x14 # Jump to address 0x14 (Start of program) 8: 241d2800 li sp,10240 # Set stack-pointer c: 08000003 j 0xc # Jump to your-self (infite loop to terminate program) 10: 00000000 nop 14: 27bdffd8 addiu sp,sp,-40 # Put some values on stack 18: afbf0010 sw ra,16(sp) 1c: 2418000a li t8,10 # Load 10 into regsiter t8 20: afb80024 sw t8,36(sp) # Put register t8 on stack 24: 24180003 li t8,3 # Load 3 into register t8 28: afb80020 sw t8,32(sp) # Put register t8 on stack 2c: 24180007 li t8,7 # Load 7 into regsiter t8 30: afb8001c sw t8,28(sp) # Put register t8 on stack 34: 8fa40024 lw a0,36(sp) # Get value from stack into argument resgiter a0 38: 8fa50020 lw a1,32(sp) # Get value from stack into argument resgiter a1 3c: 0c00005e jal 0x178 # Call function __mul (multiply function) 40: 00000000 nop 44: 8faf001c lw t7,28(sp) # Get value from stack into register t7 48: 00000000 nop 4c: 004fc021 addu t8,v0,t7 # Add result register v0 and resgiter t7, put result in t8 50: afb80018 sw t8,24(sp) 54: 8fbf0010 lw ra,16(sp) 58: 27bd0028 addiu sp,sp,40 5c: 03e00008 jr ra # End of the program, return to boot-loader 60: 00000000 nop 64: 00801021 move v0,a0 # A set of un-used shift functions 68: 30a80001 andi t0,a1,0x1 6c: 11000002 beqz t0,0x78 70: 00000000 nop 74: 00021040 sll v0,v0,0x1 78: 30a80002 andi t0,a1,0x2 7c: 11000002 beqz t0,0x88 80: 00000000 nop 84: 00021080 sll v0,v0,0x2 88: 30a80004 andi t0,a1,0x4 8c: 11000002 beqz t0,0x98 90: 00000000 nop 94: 00021100 sll v0,v0,0x4 98: 30a80008 andi t0,a1,0x8 9c: 11000002 beqz t0,0xa8 a0: 00000000 nop a4: 00021200 sll v0,v0,0x8 a8: 30a80010 andi t0,a1,0x10 ac: 11000002 beqz t0,0xb8 b0: 00000000 nop b4: 00021400 sll v0,v0,0x10 b8: 03e00008 jr ra bc: 00000000 nop c0: 00801021 move v0,a0 c4: 30a80001 andi t0,a1,0x1 c8: 11000002 beqz t0,0xd4 cc: 00000000 nop d0: 00021043 sra v0,v0,0x1 d4: 30a80002 andi t0,a1,0x2 d8: 11000002 beqz t0,0xe4 dc: 00000000 nop e0: 00021083 sra v0,v0,0x2 e4: 30a80004 andi t0,a1,0x4 e8: 11000002 beqz t0,0xf4 ec: 00000000 nop f0: 00021103 sra v0,v0,0x4 f4: 30a80008 andi t0,a1,0x8 f8: 11000002 beqz t0,0x104 fc: 00000000 nop 100: 00021203 sra v0,v0,0x8 104: 30a80010 andi t0,a1,0x10 108: 11000002 beqz t0,0x114 10c: 00000000 nop 110: 00021403 sra v0,v0,0x10 114: 03e00008 jr ra 118: 00000000 nop 11c: 00801021 move v0,a0 120: 30a80001 andi t0,a1,0x1 124: 11000002 beqz t0,0x130 128: 00000000 nop 12c: 00021042 srl v0,v0,0x1 130: 30a80002 andi t0,a1,0x2 134: 11000002 beqz t0,0x140 138: 00000000 nop 13c: 00021082 srl v0,v0,0x2 140: 30a80004 andi t0,a1,0x4 144: 11000002 beqz t0,0x150 148: 00000000 nop 14c: 00021102 srl v0,v0,0x4 150: 30a80008 andi t0,a1,0x8 154: 11000002 beqz t0,0x160 158: 00000000 nop 15c: 00021202 srl v0,v0,0x8 160: 30a80010 andi t0,a1,0x10 164: 11000002 beqz t0,0x170 168: 00000000 nop 16c: 00021402 srl v0,v0,0x10 170: 03e00008 jr ra 174: 00000000 nop 178: 24020000 li v0,0 # __mul (multiply) function 17c: 00805021 move t2,a0 180: 00a05821 move t3,a1 184: 31480001 andi t0,t2,0x1 188: 11000002 beqz t0,0x194 18c: 00000000 nop 190: 004b1021 addu v0,v0,t3 194: 000a5042 srl t2,t2,0x1 198: 1540fffa bnez t2,0x184 19c: 000b5840 sll t3,t3,0x1 1a0: 03e00008 jr ra 1a4: 00000000 nop
Step 8

We are now done within the cygwin environment. To simulate the execution of our binary program on our miniMIPS model, we must load our binary during the simulation of our SystemC miniMIPS model. To do this, we replace the existing file ‘mips_rom.bin’, which can be found in the directory containing our SystemC model (e.g. d:\mmips\mips\pipelined_nonsyn\) with our binary (i.e. main).

We now start C++Builder and compile and run our SystemC miniMIPS model. (See for more on this the getting started guide of assignment 1) As a result we get a file called mips.vcd. This file conatins a trace of all event that occured during the simulation. The content of the file can be observed with the WinWave viewer.

The picture below show the outcome of the simulation of our test program on our SystemC miniMIPS model.

Basic usage

This section describes how you can use the LCC compiler. As with any other compiler, you must first compile all source code (C/C++) files and then link the resulting object files into a binary.

Step 1: Compile the source code

Assume that we have a program which consists of 2 files foo1.cc and foo2.cc. Before we can make a binary of these files, we must first compile them. With lcc we use the following two commands:

lcc -c foo1.cc -o foo1.o
lcc -c foo2.cc -o foo2.o

The -c option tells the compiler that it should compile the source code file (e.g. foo1.cc and foo2.cc). After the -o option we put the name of the output file produced by the compiler.

Step 2: Link the object files

After all source code files have been compiled, we can link them into one binary. In our example, we have two object files foo1.o and foo2.o. Using the following command, we link them into the binary foo.

lcc foo1.o foo2.o -o foo
Note:

Remeber that the LCC compiler must be available in the PATH. For more information on how you can do this see the FAQ.

(Re-)building the LCC compiler

  1. Open a bash-shell by double-clicking on the bash icon on you desktop.
  2. Set the LCCDIR variabele in the environment to the directory containing the LCC executable. Do this using the following command:

export LCCDIR=/cygdrive/D/mmips/lcc/lccdir
PATH=$LCCDIR:$PATH
cd /cygdrive/D/mmips/lcc
make clean
make
export LCCDIR=/cygdrive/D/mmips/lcc/lccdir PATH=$LCCDIR:$PATH cd /cygdrive/D/mmips/lcc make clean make

MIPS operations

An instruction on how MIPS operations can be added to the LCC compiler can be found here.

Custom operations

An instruction on how custom operations can be added to the LCC compiler can be found here.
Last updated: Thu, 6 May 2004 09:10:23 +0200

Компилятор «LCC» (ТВГИ.00500-01)

Фирменный оптимизирующий компилятор языков C, C++, Fortran.

Цена по прайс-листу
Информация
Характеристики

Фирменный компилятор компании АО «МЦСТ» — разработчика архитектуры Эльбрус. Поддерживает языки программирования C, C++, Fortran. Во многом совместим с компилятором GCC (GNU Compiler Collection) — как по параметрам запуска, так и по GNU-расширениям языков. Обладает развитыми средствами оптимизации генерируемого машинного кода, позволяющими выбирать между быстродействием программы и её размером, а также длительностью компиляции.

Выпускается для компьютеров архитектуры Эльбрус и SPARC (МЦСТ-R). Поставляется в составе Системы программирования «Эльбрус» — штатно вместе с операционной системой либо или отдельно, по договору поставки. Поддерживает операционные системы семейства Linux и QNX; описание варианта для QNX «Нейтрино» в ТВГИ.00935-01.

Кросс-компилятор — это вариант компилятора, функционирующий на компьютерах архитектуры x86-64 и при этом выдающий машинный код архитектуры Эльбрус или SPARC. Получить кросс-компилятор можно по запросу в службу поддержки при наличии лицензии на право использования обычного компилятора (системы программирования) — для этого необходимо сообщить модель компьютера (процессора), наименование и номер версии целевой операционной системы. Вместе с кросс-компилятором для удобства может быть предоставлен архив файлов предустановленной системы «Эльбрус Линукс», если она является целевой системой для сборки программ.

Версия LCC 1.28 1.27 1.26 1.25 1.24 1.23 1.21 1.19
Год выпуска 2023 2022 2021 2020 2019 2018 2016 2014
Поддержка C++ GCC ≈ 11.3 9.3 9.3 7.3 7.3 5.5 4.8 4.4
libstdc++ 6.0.29 6.0.28 6.0.28 6.0.24 6.0.24 6.0.21 6.0.18 6.0.11
C++23 ± ± ± ±
C++20 ± ± ± ±
C++17 + ± ± ± ±
C++14 + + + + + + ±²
C++11 + + + + + + ±²
C++03 + + + + + + + +
C++98 + + + + + + + +
Поддержка C GCC ≈ 11.3 9.3 9.3 7.3 7.3 5.5 4.8 4.4
libc 2.35 2.35 2.29 2.29 2.29 2.23 2.23 2.19
C18 + + +
C11 + + + +
C99 + + + + + + + +
C90 + + + + + + + +
Поддержка Fortran GCC ≈ 10.3⁴ 10.3⁴ 5.5³ 5.5 5.5 4.9 4.9 4.4
libfortran 5.0.0 5.0.0 4.0.0 3.0.0 3.0.0 2.0.0 2.0.0 1.0.0
F18 ± ± ± ± ±
F08 + ± ± ± ± ± ±
F03 + ± ± ± ± ± ±
F95 + + + + + + + +

Знак „+“ означает, что стандарт поддержан полностью, „±“ означает поддержку в экспериментальном режиме и/или неполностью — см. сноски и документацию, „−“ означает отсутствие поддержки данного языкового стандарта в данной версии компилятора.

¹ Стандарт C11 (ISO/IEC 9899:2011) в версиях LCC 1.21–1.24 был поддержан полностью за исключением необязательного расширения _Atomic .

² Стандарты C++11 (ISO/IEC 14882:2011) и C++14 (ISO/IEC 14882:2014) в версии LCC 1.21 были поддержаны полностью в языковой части, однако в библиотечной части отсутствовала поддержка классов std::exception_ptr и std::nested_exception — это было обусловлено отсутствием поддержки zero cost exceptions (0eh) со стороны компилятора на тот момент.

³ Номинальная совместимость LCC 1.26 с gfortran-5.5.0, неполная совместимость с gfortran-6.5.0 и gfortran-7.3.0.

⁴ Номинальная совместимость LCC 1.27 / 1.28 с gfortran-10.3.0, неполная совместимость с gfortran-11.2.0 / 11.3.0.

Перевод «LCC» на русский

The LCC result is often used to provide guidance in issues concerning specific processes or specific product design elements.

Результат LCC часто используется для предоставления рекомендаций по вопросам, касающимся конкретных технологических процессов или элементов конструкции продукта.

The LCC is like a wind tunnel, but filled with a 1.5 million gallons of fresh water.
LCC похож на аэродинамическую трубу, но заполненной 1,5 миллионами галлонов пресной воды.

Large-cell carcinoma (LCC) is a heterogeneous group of undifferentiated malignant neoplasms that lack the cytologic and architectural features of small cell carcinoma and glandular or squamous differentiation.

Крупноклеточный рак (LCC) представляет собой гетерогенную группу недифференцированных злокачественных новообразований, в которых отсутствуют цитологические и архитектурные особенности мелкоклеточного рака и железистой или плоскоклеточной дифференцировки.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *