Skip to content

AntonRydahl/flangtests

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comparing Code Generation in clang and flang-new

This repository contains simple examples which have been used to compare the LLVM IR generated by the LLVM native C and FORTRAN compilers

Compilation

The ./src folder contains C and FORTRAN source code that can be compiled with

make FC=flang-new CC=clang APP=file_name OPT=<-O0,...,-Ofast>

This will generate multiple output files. LLVM IR is stored in ./ir/, bitcode in ./bitcode/, object files in ./lib/, and executables in ./bin/.

Calling FORTRAN Subroutines and Functions from C

The folder ./cbindings_offloading contains examples of how FORTRAN subroutines can be called from OpenMP target offloading regions in C. It is shown how functions and subroutines are called in different ways, and how the functions can be called by other names in C.

Dumping Intermediate Representations

The LLVM IR can be printed after each LLVM optimization pass with make llvmirdump for both flang-new anfd clang. As flang-new does not lower the source code directly to LLVM IR, it may be necessary to inspect other levels of intermediate representation. The MLIR from flang-new can be printed with make mlirdump.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • LLVM 76.4%
  • Assembly 18.9%
  • Fortran 2.4%
  • C 1.6%
  • Other 0.7%