[compiler-rt] r334001 - [XRay][compiler-rt] Use static instead of inline (NFC)

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 5 03:18:40 PDT 2018


Author: dberris
Date: Tue Jun  5 03:18:39 2018
New Revision: 334001

URL: http://llvm.org/viewvc/llvm-project?rev=334001&view=rev
Log:
[XRay][compiler-rt] Use static instead of inline (NFC)

We don't actually need to support multiple definitions of the functions
in FDR mode, but rather want to make sure that the implementation-detail
functions are marked as 'static' instead. This allows the inliner to do
its magic better for these functions too, since inline functions must
have a unique address across translation units.

Modified:
    compiler-rt/trunk/lib/xray/xray_fdr_logging.cc

Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=334001&r1=334000&r2=334001&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Tue Jun  5 03:18:39 2018
@@ -199,7 +199,7 @@ static void writeNewBufferPreamble(tid_t
                memory_order_release);
 }
 
-inline void setupNewBuffer(int (*wall_clock_reader)(
+static void setupNewBuffer(int (*wall_clock_reader)(
     clockid_t, struct timespec *)) XRAY_NEVER_INSTRUMENT {
   auto &TLD = getThreadLocalData();
   auto &B = TLD.Buffer;
@@ -223,7 +223,7 @@ static void decrementExtents(size_t Subt
   atomic_fetch_sub(&TLD.Buffer.Extents->Size, Subtract, memory_order_acq_rel);
 }
 
-inline void writeNewCPUIdMetadata(uint16_t CPU,
+static void writeNewCPUIdMetadata(uint16_t CPU,
                                   uint64_t TSC) XRAY_NEVER_INSTRUMENT {
   auto &TLD = getThreadLocalData();
   MetadataRecord NewCPUId;
@@ -243,7 +243,7 @@ inline void writeNewCPUIdMetadata(uint16
   incrementExtents(sizeof(MetadataRecord));
 }
 
-inline void writeTSCWrapMetadata(uint64_t TSC) XRAY_NEVER_INSTRUMENT {
+static void writeTSCWrapMetadata(uint64_t TSC) XRAY_NEVER_INSTRUMENT {
   auto &TLD = getThreadLocalData();
   MetadataRecord TSCWrap;
   TSCWrap.Type = uint8_t(RecordType::Metadata);
@@ -262,7 +262,7 @@ inline void writeTSCWrapMetadata(uint64_
 
 // Call Argument metadata records store the arguments to a function in the
 // order of their appearance; holes are not supported by the buffer format.
-static inline void writeCallArgumentMetadata(uint64_t A) XRAY_NEVER_INSTRUMENT {
+static void writeCallArgumentMetadata(uint64_t A) XRAY_NEVER_INSTRUMENT {
   auto &TLD = getThreadLocalData();
   MetadataRecord CallArg;
   CallArg.Type = uint8_t(RecordType::Metadata);
@@ -274,9 +274,8 @@ static inline void writeCallArgumentMeta
   incrementExtents(sizeof(MetadataRecord));
 }
 
-static inline void
-writeFunctionRecord(int FuncId, uint32_t TSCDelta,
-                    XRayEntryType EntryType) XRAY_NEVER_INSTRUMENT {
+static void writeFunctionRecord(int FuncId, uint32_t TSCDelta,
+                                XRayEntryType EntryType) XRAY_NEVER_INSTRUMENT {
   FunctionRecord FuncRecord;
   FuncRecord.Type = uint8_t(RecordType::Function);
   // Only take 28 bits of the function id.
@@ -420,7 +419,7 @@ static void rewindRecentCall(uint64_t TS
   }
 }
 
-inline bool releaseThreadLocalBuffer(BufferQueue &BQArg) {
+static bool releaseThreadLocalBuffer(BufferQueue &BQArg) {
   auto &TLD = getThreadLocalData();
   auto EC = BQArg.releaseBuffer(TLD.Buffer);
   if (EC != BufferQueue::ErrorCode::Ok) {
@@ -431,7 +430,7 @@ inline bool releaseThreadLocalBuffer(Buf
   return true;
 }
 
-inline bool prepareBuffer(uint64_t TSC, unsigned char CPU,
+static bool prepareBuffer(uint64_t TSC, unsigned char CPU,
                           int (*wall_clock_reader)(clockid_t,
                                                    struct timespec *),
                           size_t MaxSize) XRAY_NEVER_INSTRUMENT {
@@ -454,7 +453,7 @@ inline bool prepareBuffer(uint64_t TSC,
   return true;
 }
 
-inline bool
+static bool
 isLogInitializedAndReady(BufferQueue *LBQ, uint64_t TSC, unsigned char CPU,
                          int (*wall_clock_reader)(clockid_t, struct timespec *))
     XRAY_NEVER_INSTRUMENT {
@@ -527,7 +526,7 @@ isLogInitializedAndReady(BufferQueue *LB
 //   - The TSC delta is representable within the 32 bits we can store in a
 //     FunctionRecord. In this case we write down just a FunctionRecord with
 //     the correct TSC delta.
-inline uint32_t writeCurrentCPUTSC(ThreadLocalData &TLD, uint64_t TSC,
+static uint32_t writeCurrentCPUTSC(ThreadLocalData &TLD, uint64_t TSC,
                                    uint8_t CPU) {
   if (CPU != TLD.CurrentCPU) {
     // We've moved to a new CPU.
@@ -545,7 +544,7 @@ inline uint32_t writeCurrentCPUTSC(Threa
   return 0;
 }
 
-inline void endBufferIfFull() XRAY_NEVER_INSTRUMENT {
+static void endBufferIfFull() XRAY_NEVER_INSTRUMENT {
   auto &TLD = getThreadLocalData();
   auto BufferStart = static_cast<char *>(TLD.Buffer.Data);
   if ((TLD.RecordPtr + MetadataRecSize) - BufferStart <=
@@ -564,7 +563,7 @@ thread_local volatile bool Running = fal
 /// walk backward through its buffer and erase trivial functions to avoid
 /// polluting the log and may use the buffer queue to obtain or release a
 /// buffer.
-inline void processFunctionHook(int32_t FuncId, XRayEntryType Entry,
+static void processFunctionHook(int32_t FuncId, XRayEntryType Entry,
                                 uint64_t TSC, unsigned char CPU, uint64_t Arg1,
                                 int (*wall_clock_reader)(clockid_t,
                                                          struct timespec *),




More information about the llvm-commits mailing list