Questions tagged [gimple]

GIMPLE is an intermediate representation language used by GCC.

GIMPLE is both a high and low level, three-address, tree-based intermediate representation language derived from breaking down GENERIC expressions into tuples recursively.

It is used by the GCC backend to perform code optimization and analysis. Optimizations done in this form are listed by Wikipedia.

GCC's page on GIMPLE can be found here.

25 questions
17
votes
3 answers

Playing with gcc's intermediate GIMPLE format

According to this article gcc uses several intermediate formats before generating code. I read that the GIMPLE format uses three address code, which seems to be the easiest intermediate language to use. But I need some more detail, as I need to…
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
13
votes
2 answers

Can GCC compile GIMPLE?

GIMPLE is one of internal representations in GCC system. It is possible to dump GIMPLE or any other internal representation via -fdump-* compiler argument. But is there any way to compile dumped GIMPLE or any other representation? It seems that GCC…
user2102508
  • 1,009
  • 11
  • 23
6
votes
2 answers

why less than expression converts into less than or equal to expression in gcc

I am working on code optimization and going through gcc internals. I wrote a simple expression in my program and I checked the gimple representation of that expression and I got stuck why gcc had done this. Say I have an expression : if(i < 9) then…
neel
  • 8,399
  • 7
  • 36
  • 50
4
votes
1 answer

Searching for recent GCC GIMPLE grammar

For my finale year project I'm learning about compiler techniques, and currently I'm trying to experiment with the GCC intermediate representation (raw GIMPLE) and getting the control flow graphs from different source files (C, Cpp and Java) using…
4
votes
1 answer

Given a GIMPLE Call statment which has two arguments, I want to add a third one, how?

I have to do some GIMPLE_CALL Statement manipulations. This GIMPLE_CALL will have two arguments, e.g: foo(a,b). My goal is change this method to a different method having THREE arguments e.g. zoo(a,b,c) In my current approach, GCC crashes during…
Ravi Shekhar
  • 78
  • 10
3
votes
1 answer

Meaning of a variable in GCC SSA format

I want to look at the SSA format GCC uses, so I tried the following simple test program: #include int main(int argc, char **argv) { int n = 0; int i; for (i = 0; i < 13; i++) n += argc; …
rwallace
  • 31,405
  • 40
  • 123
  • 242
3
votes
1 answer

How to analyse GCC Internal Representation like GIMPLE, RTL

I have generated dump output files using command -fdump-tree-all and -fdump-rtl-all and I got a lot of dump files. I have read that the codes in GIMPLE are in pseudo-C syntax and RTL dump files are too low level to be understood. Is there any ways…
linuxqwerty
  • 198
  • 16
3
votes
1 answer

Register a GIMPLE pass in gcc 5.1.0

Hi I've been doing gcc plugins for gcc 4.8 and 4.9 but I'm having a problem in gcc 5.1.0. The problem is that I can't register a GIMPLE pass in this new gcc version. Here is an example plugin code: int plugin_is_GPL_compatible; static bool…
Andres Tiraboschi
  • 543
  • 1
  • 7
  • 17
3
votes
2 answers

How can I dump ALL Gimple trees?

I need to dump all Gimple trees (kind of -fdump-tree-whatever). I created a plugin for the purpose, but I am not sure how should I access Gimple trees in pass. Plugin is hooked into GIMPLE_PASS: static struct opt_pass my_pass = { .type =…
notnull
  • 1,908
  • 3
  • 19
  • 25
2
votes
1 answer

Cannot figure out /[ex] operator from gcc's -fdump-tree-gimple

When compiling C++ with the -fdump-tree-gimple option (GCC 4.6.1), I get code that has the following function in it: std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int, _Alloc = std::allocator] (struct _Vector_base * const this) { …
Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
2
votes
0 answers

Finding arguments of a function call gimple statement

gimple_call_num_args(stmt) on my statement gives 2 but get_name(gimple_call_arg(stmt,1)) is null. Any ideas on how to get the arguments?
gst1502
  • 306
  • 1
  • 10
2
votes
2 answers

Use gcc plugins to modify the order of variable declarations

I know this is very hard to do, and that I should avoid that, but I have my reasons for this. I want to modify the order of some field declarations in compilation time, for example : class A { char c; int i; } must turn to : class A { …
Othman Benchekroun
  • 1,998
  • 2
  • 17
  • 36
2
votes
2 answers

print called function name using GCC plugin

I need to print the name of the called functions of a program using gcc plugins for this I created a pass that will be called after ssa pass, I already initiated the plugin and I can loop on its statements, using a gimple_stmt_iterator : int…
Othman Benchekroun
  • 1,998
  • 2
  • 17
  • 36
2
votes
0 answers

How to compile a C/C++ code into a three address code written by C/C++code?

I want to compile a C/C++ code into a three address code, which is also a legal C/C++ code. I'm doing an experiment, in which I have to analyze the three address code and add some C codes into the generated three address code. The modified three…
MyID
  • 21
  • 2
2
votes
1 answer

Inserting function calls in the gimple

I'm having problems figuring out how to do the next thing. I have the following code: test.cpp #include void function(void) {printf("Hellow ");} int main(void) { printf("World\n"); return 0; } And I want to transform it into the…
Andres Tiraboschi
  • 543
  • 1
  • 7
  • 17
1
2