Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

-1 votes
0 answers
21 views

Why is GCC not used as Shader Compiler in Mesa? [closed]

Mesa GPU driver currently employs LLVM by default or Valve's ACO as a shader compiler. Why doesn't Mesa use GCC as default for shader compilation like GCC is default for building Linux/BSD? Mesa is ...
DanglingPointer's user avatar
0 votes
3 answers
115 views

When inlining a C function, can an optimizing compiler dereference a pointer more times than explicitly written in the source code?

Consider the following code: int y = 1; int* p = &y; inline int f(int x) { return x + x; } int g(void) { return f(*p); } In this code, there is one explicit dereference. Is a C compiler ...
john smith's user avatar
0 votes
0 answers
19 views

why in calling a function by GCC convention , the passed parameters are stored in a reversed order in the stack

Can you help me answer this question. I have tried to figure this out by myself but didn't succeed. Is it because we don't know the amount of memory the function will use ?
sallyaaa's user avatar
1 vote
1 answer
125 views

What is the reasoning behind this boilerplate start-up code?

Here's a snippet from disassembled output of a simple program with gcc on Linux: 400478: ff 15 6a 0b 20 00 callq *0x200b6a(%rip) # 600fe8 <__libc_start_main@GLIBC_2.2.5> ...
user129393192's user avatar
0 votes
0 answers
89 views

How to compile to RISC-V?

I'm writing the final stage for my compiler to riscv; however, I have run into a minor issue of figuring out what the start point of the program is. Are we guaranteed that the PC starts execution with ...
user129393192's user avatar
1 vote
0 answers
32 views

Unknown type name ‘Node’ in the parser file. (Yacc program)

I've been working on a Yacc program (parser.y) to develop a small compiler that handles arithmetic operations. I'm using Yacc (Bison) and Lex tools to generate the parser and lexical analyzer, ...
Don R's user avatar
  • 41
0 votes
1 answer
28 views

Where can I find the body of the function pointed to by the function pointer of cfg_hooks in gcc source code?

In gcc cfghooks.cc void predict_edge (edge e, enum br_predictor predictor, int probability) { if (!cfg_hooks->predict_edge) internal_error ("%s does not support predict_edge", ...
yh wang's user avatar
  • 11
2 votes
0 answers
110 views

Write a gcc plugin that inserts macros at the beginning of each function

I understand that I can use __cyg_profile_func_enter and -finstrument-functions to insert code, but is it possible to insert macros by writing a gcc plugin? Is there any documentation or possibly an ...
Coloda's user avatar
  • 39
1 vote
0 answers
65 views

How to force GCC change the generated assembly order of a branch?

My problem is deterministically arranging the position of different branches' code in the compiled binary/assembly. Note that my primary goal is NOT to optimize performance, but to be sure to have a ...
rand0m_scr1pt_k1dd1e's user avatar
0 votes
0 answers
20 views

modifying AST as constructed in gcc

I would like to add a few branches to the AST as being constructed by the parser of gcc, https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/parser.cc What is the variable that holds the AST as being ...
0x11111's user avatar
  • 185
3 votes
0 answers
69 views

With gcc -O3 optimization, why does the loop index's type affect gcc's internal GIMPLE vector constants (but not the final asm)?

I created a struct array, and here is my source code. #include <stdio.h> #include <stdlib.h> #define N 256 typedef struct arc { int num; } arc_t; typedef double cost_t; typedef ...
Daisy G's user avatar
  • 31
6 votes
3 answers
380 views

Why compilers doesn't inline everything, analyze it and then generate their own optimized functions?

Problem summary I'm trying to do an in-memory database with transactions. I'm reaching bottlenecks on compiler level, specifically inlining limit. I don't have much knowledge about compilers and I ...
user1576055's user avatar
0 votes
0 answers
26 views

Which gcc O2 option do this constant folding?

I am not familiar with gcc,this code: int a=145;int b=267+a; printf("%d/n",b); if comiple with no optimize option,will use the "addl" command,but if open O2 option,it will show me ...
wang kai's user avatar
  • 1,735
0 votes
1 answer
204 views

DWARF output differs between compiler versions

I compile an ELF file including debug info and then read the debug-info back and parse it to get a list of all variables (global variables and class variables) in the RAM. This already works with the ...
Martin's user avatar
  • 11
1 vote
1 answer
86 views

Why doesn't the generated GCC code for array allocation and access follow the `movl (%rdx, %rcx, 4), %eax` formula?

I am thinking about how to compile arrays in x86-64 assembly. I am reading "Computer Systems - A Programmer's Perspective" and the authors give the following formula: E[i] -> `movl (%rdx,...
chez93's user avatar
  • 149

15 30 50 per page
1
2 3 4 5
53