[all-commits] [llvm/llvm-project] ca41e0: [Flang][Lower] Attach target_cpu and target_featur...
Sergio Afonso via All-commits
all-commits at lists.llvm.org
Fri Jan 19 08:31:57 PST 2024
Branch: refs/heads/users/skatrak/spr/target-attrs-flang
Home: https://github.com/llvm/llvm-project
Commit: ca41e03ee3bf1c5e465edf53a337cbc7498658da
https://github.com/llvm/llvm-project/commit/ca41e03ee3bf1c5e465edf53a337cbc7498658da
Author: Sergio Afonso <safonsof at amd.com>
Date: 2024-01-19 (Fri, 19 Jan 2024)
Changed paths:
M flang/include/flang/Lower/Bridge.h
M flang/include/flang/Optimizer/CodeGen/CGPasses.td
M flang/include/flang/Optimizer/CodeGen/Target.h
M flang/include/flang/Optimizer/Dialect/Support/FIRContext.h
M flang/lib/Frontend/FrontendActions.cpp
M flang/lib/Lower/Bridge.cpp
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/lib/Optimizer/CodeGen/Target.cpp
M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
M flang/lib/Optimizer/CodeGen/TypeConverter.cpp
M flang/lib/Optimizer/Dialect/Support/FIRContext.cpp
M flang/test/Driver/save-mlir-temps.f90
A flang/test/Fir/target-rewrite-target-cpu.fir
A flang/test/Fir/target-rewrite-target-features.fir
A flang/test/Lower/target-features-amdgcn.f90
A flang/test/Lower/target-features-x86_64.f90
M flang/tools/bbc/bbc.cpp
M flang/tools/tco/tco.cpp
M flang/unittests/Optimizer/FIRContextTest.cpp
Log Message:
-----------
[Flang][Lower] Attach target_cpu and target_features attributes to MLIR functions
This patch forwards the target CPU and features information from the Flang
frontend to MLIR func.func operation attributes, which are later used to
populate the target_cpu and target_features llvm.func attributes.
This is achieved in two stages:
1. Introduce the `fir.target_cpu` and `fir.target_features` module
attributes with information from the target machine immediately after the
initial creation of the MLIR module in the lowering bridge.
2. Update the target rewrite flang pass to get this information from the
module and pass it along to all func.func MLIR operations, respectively as
attributes named `target_cpu` and `target_features`. These attributes will
be automatically picked up during Func to LLVM dialect lowering and used to
initialize the corresponding llvm.func named attributes.
The target rewrite and FIR to LLVM lowering passes are updated with the ability
to override these module attributes, and the `CodeGenSpecifics` optimizer class
is augmented to make this information available to target-specific MLIR
transformations.
This completes a full flow by which target CPU and features make it all the way
from compiler options to LLVM IR function attributes.
More information about the All-commits
mailing list