Chivyham Humber
Chivyham Humber

Reputation: 51

What's the meaning of '#x.x' in assemble copiled by icc?

I compile come simple code with intel icc compiler, and I notice that there are some numbers at the end of each line. I wanna know the meaning.

Just like #3.12 in the following code.

#include <stdio.h>

int main() {
    int a = 3, b;
    scanf("%d", &b);
    a = a + b;
    printf("Hello, world! I am %d\n", a);
    return 0;
}
...
main:
..B1.1:                         # Preds ..B1.0
                                # Execution count [1.00e+00]
..L1:
                                                          #3.12
        pushl     %ebp                                          #3.12
        movl      %esp, %ebp                                    #3.12
        andl      $-128, %esp                                   #3.12
...

Upvotes: 4

Views: 72

Answers (2)

nielsen
nielsen

Reputation: 7794

It is indeed the line and column of the corresponding source code. #3.12 is the opening { of the main function which makes sense since the shown statements are consistent with the start of a function.

If you insert an extra space before the { you will see that the output changes to #3.13; likewise the 3 changes to 4 if you insert an empty line before the main()function.

Upvotes: 2

Silerus
Silerus

Reputation: 36

This is the procedure for preparing the start of a function, also called the function header. Here we hide the return address on the stack and allocate empty space on the stack for the function to work. Pay attention at the end is the reverse process. Here is an example of the same from another compiler:

        push    ebp
        mov     ebp, esp
        sub     esp, 8
        ...
        mov     esp, ebp
        pop     ebp
        ret     0

Upvotes: 0

Related Questions