lfortran / lfortran

Official main repository for LFortran
https://lfortran.org/
Other
920 stars 137 forks source link

Add option `-fdefault-integer-8` #2844

Open meow464 opened 9 months ago

meow464 commented 9 months ago

Possibly add other similar options. Lapack uses this options in its build system. Where should I look at to implement this option?

certik commented 9 months ago

It would be implemented in the frontend. This would be part of:

$ lfortran -h
[...]
  -f TEXT ...            All `-f*` flags (only -fPIC supported for now)
[...]
meow464 commented 9 months ago

I was under the impression that kind selection happens during the asr lowering? https://github.com/lfortran/lfortran/blob/f345516553a3b1c36485de9879bfbb146cda602f/src/libasr/ASR.asdl#L386

certik commented 9 months ago

This would happen in the frontend: AST->ASR, which would choose integer to become kind=8 in ASR. No change will be needed in the lowering (ASR->LLVM).

meow464 commented 9 months ago

Is there any documentation on the lfortran internals? I'm walking through the code but I can't find where the lowering from AST integers to ASR integers happen. If I print the AST and ASR for a simple example I can see they are different but I can't get much further than that. I found ASR::make_integer_t but I think that's for lowering to IR right?

certik commented 9 months ago

Browse the documentation here: https://docs.lfortran.org/en/, and also you can watch this video which shows how the internals work: https://www.youtube.com/watch?v=yuYsyM08bss.