[flang-commits] [flang] b8bac6b - [flang] Add runtime interface for SYSTEM_CLOCK

Diana Picus via flang-commits flang-commits at lists.llvm.org
Tue Jun 29 01:25:53 PDT 2021


Author: Diana Picus
Date: 2021-06-29T08:25:01Z
New Revision: b8bac6b33c576dec88add0e6a68e96219e278c8a

URL: https://github.com/llvm/llvm-project/commit/b8bac6b33c576dec88add0e6a68e96219e278c8a
DIFF: https://github.com/llvm/llvm-project/commit/b8bac6b33c576dec88add0e6a68e96219e278c8a.diff

LOG: [flang] Add runtime interface for SYSTEM_CLOCK

SYSTEM_CLOCK may take up to 3 optional parameters, all of which are
INTENT(OUT). The COUNT and COUNT_MAX parameters are integer scalars,
while COUNT_RATE may be a real or integer scalar.

This patch breaks up the interface into 3 different functions, one for
each parameter. All 3 return integers. It is up to lowering to convert
the results to the preferred type.

Differential Revision: https://reviews.llvm.org/D104851

Added: 
    

Modified: 
    flang/runtime/time-intrinsic.h

Removed: 
    


################################################################################
diff  --git a/flang/runtime/time-intrinsic.h b/flang/runtime/time-intrinsic.h
index 835f24c0b324e..391d72cef18fa 100644
--- a/flang/runtime/time-intrinsic.h
+++ b/flang/runtime/time-intrinsic.h
@@ -22,6 +22,12 @@ extern "C" {
 // real kind.
 double RTNAME(CpuTime)();
 
+// Interface for the SYSTEM_CLOCK intrinsic. We break it up into 3 distinct
+// function calls, one for each of SYSTEM_CLOCK's optional output arguments.
+// Lowering will have to cast the results to whatever type it prefers.
+CppTypeFor<TypeCategory::Integer, 8> RTNAME(SystemClockCount)();
+CppTypeFor<TypeCategory::Integer, 8> RTNAME(SystemClockCountRate)();
+CppTypeFor<TypeCategory::Integer, 8> RTNAME(SystemClockCountMax)();
 } // extern "C"
 } // namespace Fortran::runtime
 #endif // FORTRAN_RUNTIME_TIME_INTRINSIC_H_


        


More information about the flang-commits mailing list