Questions tagged [intermediate-code]
44 questions
28
votes
7 answers
What does Backpatching mean?
What does backpatching mean ? Please illustrate with a simple example.

saplingPro
- 20,769
- 53
- 137
- 195
14
votes
1 answer
Advantages of stack-based bytecodes or infinite register machines
Compilers often choose intermediate representations (IRs) that are either stack-based or infinite register. What are the advantages of these over expression trees?

J D
- 48,105
- 13
- 171
- 274
9
votes
1 answer
What is the LLVM intermediate representation?
I have tried the LLVM demo from Try out LLVM and Clang in your browser!.
What kind of IR is this? HIR, MIR, or LIR? The SSA representation is usually used in MIR, I think. So, is it an MIR? But it can store the information for dependence analysis.…

ViG
- 455
- 5
- 8
8
votes
2 answers
Generating intermediate code in a compiler. Is an AST or parse tree always necessary when dealing with conditionals?
I'm taking a compiler-design class where we have to implement our own compiler (using flex and bison). I have had experience in parsing (writing EBNF's and recursive-descent parsers), but this is my first time writing a compiler.
The language design…

Vivin Paliath
- 94,126
- 40
- 223
- 295
7
votes
4 answers
Choosing an intermediate language
I am currently playing around with programming languages. I have spent some time writing parsers and interpreters in high level languages (most notably Haxe).
I have had some results, that I think are actually quite nice, but now I'd like to make…

back2dos
- 15,588
- 34
- 50
6
votes
2 answers
Generating intermediate .i files (preprocessed files) when compiling Ubuntu-8.04
I'm building ubuntu-8.04 with gcc 3.4 and I need to generate the .i files, which are the output of the gcc preprocessor. I have tried adding the --save-temps flag but this only generates the .i files for the top level directory, i.e. source, and…

Sara
- 61
- 1
- 2
4
votes
1 answer
What is wrong with this LLVM IR code
I have an LLVM IR code that looks something like this.
%8 = load i64* @tid, align 8
%arrayidx1 = getelementptr inbounds [16 x i32]* @h,
i32 0, i64 %8 ;<-- %8 works fine here
..............
%OldFuncCounter7 = load i64* getelementptr…

pythonic
- 20,589
- 43
- 136
- 219
3
votes
2 answers
Is there any way to write a compiler front end without using syntax-directed translation?
My question is the same as the title. I just want to know if there are any other translation techniques to get the intermediate code that doesn't rely on embedding actions into the parser (that is, the parser will strictly create the abstract syntax…

Sean Kelleher
- 1,952
- 1
- 23
- 34
3
votes
1 answer
How does a compiler identify its host machine's hardware? Which component?
My teacher told me that the intermediate code is generic for all systems but a component of the compiler then make it different according the system/environment the code is run on. Can someone please explain it.

Vivek Sharma
- 61
- 5
3
votes
1 answer
What is the purpose of code optimization at intermediate phase in compiler?
Some code optimizations are carried out on the intermediate code because
They enhance the portability of the compiler to the target processor
Program analysis is more accurate on intermediate code than on machine code
The information from dataflow…
user4791206
3
votes
5 answers
Which is a good and simple intermediate code?
Suppose that the purpose of an assignment is to write a compiler that works on a subset of C language (you can assume a subset of whatever language, just supporting basic scripting expressiveness without having complex things as objects).
What kind…

Jack
- 131,802
- 30
- 241
- 343
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…

Szymon Brych
- 111
- 2
- 10
2
votes
3 answers
How to access the MSIL code of compiled .NET assemblies?
VB.NET and C# (and other language) compilers generate MSIL code. How can I see that code?
What is there in that file? Where does that file reside and how can I access that?
Second question:
How do I compile a C# program from the cmd prompt and how…

Kishore Kumar
- 12,675
- 27
- 97
- 154
2
votes
2 answers
How to check equality of iterator?
In my llvm code, I try to check if the iterator InsertPos is pointing to the last instruction of a basic block, with the following code.
BasicBlock::iterator InsertPos = BB->begin();
LLVMContext &Context = BB->getContext();
while ( !(…

MetallicPriest
- 29,191
- 52
- 200
- 356
1
vote
1 answer
Insert the getelementptr instruction
I want to insert the getelementpr instruction in my code, like the one shown below.
%i1 = getelementptr inbounds [16 x i64]* @Counters, i64 0, i64 %8
How can I insert that? I can insert load and store instructions by using the constructors of…

MetallicPriest
- 29,191
- 52
- 200
- 356