Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-16 Thread Adriaan van Os via fpc-devel
Jonas Maebe via fpc-devel wrote: On 14/12/2023 08:41, Adriaan van Os via fpc-devel wrote: Jonas Maebe via fpc-devel wrote: I'd rather not introduce directives that are specific to clang, and especially none only apply to the next loop. We don't have a single directive yet that works like this

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-16 Thread Jonas Maebe via fpc-devel
On 14/12/2023 08:41, Adriaan van Os via fpc-devel wrote: Jonas Maebe via fpc-devel wrote: I'd rather not introduce directives that are specific to clang, and especially none only apply to the next loop. We don't have a single directive yet that works like this. The latter is a good point and

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-14 Thread Adriaan van Os via fpc-devel
Jonas Maebe via fpc-devel wrote: I'd rather not introduce directives that are specific to clang, and especially none only apply to the next loop. We don't have a single directive yet that works like this. The latter is a good point and that's why I would suggest to make their Pascal equivalen

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-13 Thread Adriaan van Os via fpc-devel
Michael Van Canneyt via fpc-devel wrote: Maybe a single {$PRAGMA XYZ} directive can be introduced to control this kind of stuff, with a fixed list of XYZ. Backends can intepret the XYZ pragmas as they see fit. Yes, a {$pragma} directive is fine for me. It seems absurd to ignore code improveme

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-13 Thread Michael Van Canneyt via fpc-devel
On Wed, 13 Dec 2023, Jonas Maebe via fpc-devel wrote: On 09/12/2023 13:35, Adriaan van Os via fpc-devel wrote: Jonas Maebe via fpc-devel wrote: So if/when we would get FPC equivalents of such directives, I could translate those to LLVM IR as well. Then I suggest the following (and I can p

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-13 Thread Jonas Maebe via fpc-devel
On 09/12/2023 13:35, Adriaan van Os via fpc-devel wrote: Jonas Maebe via fpc-devel wrote: So if/when we would get FPC equivalents of such directives, I could translate those to LLVM IR as well. Then I suggest the following (and I can prepare a patch to the code and docs if it were to be accep

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-09 Thread Adriaan van Os via fpc-devel
Jonas Maebe via fpc-devel wrote: On 09/12/2023 10:07, Adriaan van Os via fpc-devel wrote: Another question. Is there a way to put pragmas in fpc source code to be passed to CLang, eg. those mentioned here ? That would gain a lot, at little cost. No.

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-09 Thread Jonas Maebe via fpc-devel
On 09/12/2023 10:07, Adriaan van Os via fpc-devel wrote: Another question. Is there a way to put pragmas in fpc source code to be passed to CLang, eg. those mentioned here ? That would gain a lot, at little cost. No. However, FPC command line paramete

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-09 Thread Adriaan van Os via fpc-devel
Jonas, It's indeed easier, and it also supports some preprocessing that llc doesn't (I don't remember what exactly llc didn't support, perhaps comments). It's also faster since you call one tool rather than 2 or 3. Another question. Is there a way to put pragmas in fpc source code to be passe

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-08 Thread Jonas Maebe via fpc-devel
On 08/12/2023 04:23, Adriaan van Os via fpc-devel wrote: Jonas Maebe via fpc-devel wrote: Because of this reason, FPC only uses llvm.dbg.addr. But clang still uses llvm.dbg.declare, and when I change FPC to use that one, the debug info for the variables in your test program is correct. So I'll

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-07 Thread Adriaan van Os via fpc-devel
Jonas Maebe via fpc-devel wrote: Because of this reason, FPC only uses llvm.dbg.addr. But clang still uses llvm.dbg.declare, and when I change FPC to use that one, the debug info for the variables in your test program is correct. So I'll change FPC to also use llvm.dbg.declare. Done. Just o

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Jonas Maebe via fpc-devel
On 06/12/2023 22:25, Jonas Maebe via fpc-devel wrote: https://releases.llvm.org/11.0.0/docs/SourceLevelDebugging.html#format-common-intrinsics states that llvm.dbg.declare is identical to llvm.dbg.addr, except that it works badly in the context of optimisations, and that as a result it is depr

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Jonas Maebe via fpc-devel
On 06/12/2023 22:17, Martin Frb via fpc-devel wrote: If I have enough code, so clang does not optimize the entire function away in -O1, then clang writes info for some of the lines. Actually the variable is in a (or several?) registers. And clang misses some lines too. But it covers some lines i

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Martin Frb via fpc-devel
On 06/12/2023 21:58, Martin Frb via fpc-devel wrote: On 06/12/2023 21:05, Jonas Maebe via fpc-devel wrote: On 06/12/2023 17:37, Martin Frb via fpc-devel wrote: Not suer if the issue is within Fpc or clang... Should this be reported against Fpc? FPC defines the variables' debug info at the st

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Martin Frb via fpc-devel
On 06/12/2023 21:05, Jonas Maebe via fpc-devel wrote: On 06/12/2023 17:37, Martin Frb via fpc-devel wrote: Not suer if the issue is within Fpc or clang... Should this be reported against Fpc? FPC defines the variables' debug info at the start of the function and defines their lifetime as sta

Re: [fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Jonas Maebe via fpc-devel
On 06/12/2023 17:37, Martin Frb via fpc-devel wrote: Not suer if the issue is within Fpc or clang... Should this be reported against Fpc? FPC defines the variables' debug info at the start of the function and defines their lifetime as starting at the beginning of the function and continuing

[fpc-devel] Wrong debug info when using clang backend

2023-12-06 Thread Martin Frb via fpc-devel
Not suer if the issue is within Fpc or clang... Should this be reported against Fpc? - Fedora 33 - Fpc 3.3.1  from Sept 26th - make all  OPT=" " OPTNEW=" -Clv11.0 " FPCMAKEOPT=" -Clv11.0 " LLVM=1 - clang --version   clang version 11.0.0 (Fedora 11.0.0-3.fc33)   Target: x86_64-unknown-linux-gnu