Questions tagged [intermediate-language]

An intermediate language, in compiler design, is a low-level language that typically resembles an idealized assembly language, often a textual representation of bytecode for a virtual machine. For .NET's CIL, use the [cil] tag.

An intermediate language, in compiler design, is a translation stage after the syntax tree and before the machine code. The term is usually used for final stages of the translation, after high-level optimizations have been performed, but at a stage when the translation is still independent of the target machine.

In particular, “intermediate language” often means a low-level, assembly-like language for a virtual machine such as the JVM, .NET, Prolog's WAM, etc.

For example, the .NET Common Intermediate Language is the assembly language for the virtual machine that is the target of and other compilers.

144 questions
3
votes
3 answers

Intermediate code from C++

I want to compile a C++ program to an intermediate code. Then, I want to compile the intermediate code for the current processor with all of its resources. The first step is to compile the C++ program with optimizations (-O2), run the linker and do…
3
votes
1 answer

Intermediate Code Generation on Functions

I am following Compiler design and I found the following problem. int fact(int n){ if(n==0) return 1; else return (n*fact(n-l)) } for the above code, following was given as the intermediate code, 1. func begin fact 2. if (n==0) goto L1 3. T1…
Klaus
  • 1,641
  • 1
  • 10
  • 22
3
votes
1 answer

Modifying IL code causing InvalidProgramException at runtime

Im trying to remove the subscription to the Tick event in IL Code so that it wont ever fire. Here is the IL Code: IL_0e19: ldftn instance void App.Framework.MainForm::mTimer_Tick(object, class [mscorlib]System.EventArgs) IL_0e1f: newobj …
CathalMF
  • 9,705
  • 6
  • 70
  • 106
3
votes
1 answer

Scala compiler output after cleanup phase

I would like to develop a tool that post-processes a scala program once all the heavy lifting has been completed by the Scala compiler. From what I understand the different phases of the Scala compiler incrementally simplify the program in terms of…
3
votes
0 answers

Do MATLAB and GNU Octave use an intermediate representation?

Do the MATLAB and GNU Octave interpreters work like interpreters in the old sense? Do they parse each line, translate it into machine code and execute or do they translate the entire code into an Intermediate Representation (like Python bytecode,…
3
votes
2 answers

ILGenerator: Load created method

I am using System.Reflection.Emit, and at some point I want to create a delegate from a MethodBuilder: MethodBuilder fooBuilder = createFooMethodBuilder(); ILGenerator ilGenerator = ... Type delegateType = typeof(DelegateType); LocalBuilder…
luiscubal
  • 24,773
  • 9
  • 57
  • 83
3
votes
2 answers

C# DLL to .il, to C++ DLL: problem with strings

I'm trying to export some functionality from C# so I can use it in my unmanaged C++ app. On my test project, I first I create a C# DLL with a simple function to write a string to a file. I then use ildasm to turn this into an intermediate language…
Warpin
  • 6,971
  • 12
  • 51
  • 77
3
votes
0 answers

Can I call an output of LLVM backend from c++ in efficient manner?

let's say I have some logic written down in some programming language with LLVM frontend available. I would like to reuse this logic in some c++ application. Can I generate some sort of library using common LLVM backends and call it from my…
3
votes
1 answer

Understanding the Dots in MSIL (CIL) Keywords

I'm working on an MSIL (CIL) code colorizer, even though I'm not that familiar with with MSIL. I found a list of all the keywords in the Common Language Infrastructure (CLI). These keywords include stuff like add, .file, conv.i4, and…
Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
3
votes
1 answer

How does backpatching work with markers?

I've searched all over the Internet and could not find a proper explanation of how backpatching works? Can you please explain me how does backpatching works? How does it work with the markers? I know it has 2 main types of markers: with next-quad…
3
votes
3 answers

Intermediate language used in scalac?

In the GCC compiler we see several 'intermediate languages': RTL, GENERIC and GIMPLE. This answer hints at the idea of an intermediate representation in scalac. My question is: is there an 'intermediate representation' of the compiler in Scala? Is…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
3
votes
2 answers

Is there an LLVM backend for Perl?

I have a project written in C which I wish to convert to Perl. A friend of mine suggested to use LLVM. I compiled my C code to LLVM assembly using Clang. Now I'm trying to convert this intermediate representation into Perl but I can't seem to find…
Rohan Durve
  • 340
  • 2
  • 14
3
votes
2 answers

Getting Started with IL (Intermediate Language)

Can anyone suggest any good resources for getting started with IL. Specifically if anyone knows of any GOOD books or screencasts I would appreciate the feedback.
Jason Irwin
  • 1,985
  • 2
  • 29
  • 42
2
votes
2 answers

Why does CMake set -no-fat-lto-objects when I enable LTO/IPO?

I'm enabling IPO (inter-procedural optimization) for a C compilation of mine, using CMake: set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) As expected, this causes an -flto compiler flag to be added. However, it also adds…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
1 answer

ECMA CLI spec: initobj instruction description for value types

The ECMA CLI spec has the following statement in the description for the initobj CLI instruction: "If typeTok is a value type, then after this instruction is executed, the instance is ready for a constructor method to be called." However, the…