diff options
| author | David L. Jones <dlj@google.com> | 2017-01-23 23:16:46 +0000 | 
|---|---|---|
| committer | David L. Jones <dlj@google.com> | 2017-01-23 23:16:46 +0000 | 
| commit | d21529fa0df71327aab230786e345b2071f4ac4f (patch) | |
| tree | dd6b1b12a5edfc22ead658b3960942d07d91c170 /llvm/lib/CodeGen | |
| parent | 8d14835b2e7862b866a1e6315fb49648d1b3e906 (diff) | |
| download | bcm5719-llvm-d21529fa0df71327aab230786e345b2071f4ac4f.tar.gz bcm5719-llvm-d21529fa0df71327aab230786e345b2071f4ac4f.zip  | |
[Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC)
Summary:
The LibFunc::Func enum holds enumerators named for libc functions.
Unfortunately, there are real situations, including libc implementations, where
function names are actually macros (musl uses "#define fopen64 fopen", for
example; any other transitively visible macro would have similar effects).
Strictly speaking, a conforming C++ Standard Library should provide any such
macros as functions instead (via <cstdio>). However, there are some "library"
functions which are not part of the standard, and thus not subject to this
rule (fopen64, for example). So, in order to be both portable and consistent,
the enum should not use the bare function names.
The old enum naming used a namespace LibFunc and an enum Func, with bare
enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
with "LibFFunc_". (Unfortunately, a scoped enum is not sufficient to override
macros.)
There are additional changes required in clang.
Reviewers: rsmith
Subscribers: mehdi_amini, mzolotukhin, nemanjai, llvm-commits
Differential Revision: https://reviews.llvm.org/D28476
llvm-svn: 292848
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 114 | 
2 files changed, 58 insertions, 58 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 9517d64447b..f30f57d0c1e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1362,7 +1362,7 @@ bool FastISel::selectInstruction(const Instruction *I) {    if (const auto *Call = dyn_cast<CallInst>(I)) {      const Function *F = Call->getCalledFunction(); -    LibFunc::Func Func; +    LibFunc Func;      // As a special case, don't handle calls to builtin library functions that      // may be translated directly to target instructions. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 277db84fded..e1b6d32fb45 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -6329,15 +6329,15 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {      // Check for well-known libc/libm calls.  If the function is internal, it      // can't be a library call.  Don't do the check if marked as nobuiltin for      // some reason. -    LibFunc::Func Func; +    LibFunc Func;      if (!I.isNoBuiltin() && !F->hasLocalLinkage() && F->hasName() &&          LibInfo->getLibFunc(F->getName(), Func) &&          LibInfo->hasOptimizedCodeGen(Func)) {        switch (Func) {        default: break; -      case LibFunc::copysign: -      case LibFunc::copysignf: -      case LibFunc::copysignl: +      case LibFunc_copysign: +      case LibFunc_copysignf: +      case LibFunc_copysignl:          if (I.getNumArgOperands() == 2 &&   // Basic sanity checks.              I.getArgOperand(0)->getType()->isFloatingPointTy() &&              I.getType() == I.getArgOperand(0)->getType() && @@ -6350,122 +6350,122 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {            return;          }          break; -      case LibFunc::fabs: -      case LibFunc::fabsf: -      case LibFunc::fabsl: +      case LibFunc_fabs: +      case LibFunc_fabsf: +      case LibFunc_fabsl:          if (visitUnaryFloatCall(I, ISD::FABS))            return;          break; -      case LibFunc::fmin: -      case LibFunc::fminf: -      case LibFunc::fminl: +      case LibFunc_fmin: +      case LibFunc_fminf: +      case LibFunc_fminl:          if (visitBinaryFloatCall(I, ISD::FMINNUM))            return;          break; -      case LibFunc::fmax: -      case LibFunc::fmaxf: -      case LibFunc::fmaxl: +      case LibFunc_fmax: +      case LibFunc_fmaxf: +      case LibFunc_fmaxl:          if (visitBinaryFloatCall(I, ISD::FMAXNUM))            return;          break; -      case LibFunc::sin: -      case LibFunc::sinf: -      case LibFunc::sinl: +      case LibFunc_sin: +      case LibFunc_sinf: +      case LibFunc_sinl:          if (visitUnaryFloatCall(I, ISD::FSIN))            return;          break; -      case LibFunc::cos: -      case LibFunc::cosf: -      case LibFunc::cosl: +      case LibFunc_cos: +      case LibFunc_cosf: +      case LibFunc_cosl:          if (visitUnaryFloatCall(I, ISD::FCOS))            return;          break; -      case LibFunc::sqrt: -      case LibFunc::sqrtf: -      case LibFunc::sqrtl: -      case LibFunc::sqrt_finite: -      case LibFunc::sqrtf_finite: -      case LibFunc::sqrtl_finite: +      case LibFunc_sqrt: +      case LibFunc_sqrtf: +      case LibFunc_sqrtl: +      case LibFunc_sqrt_finite: +      case LibFunc_sqrtf_finite: +      case LibFunc_sqrtl_finite:          if (visitUnaryFloatCall(I, ISD::FSQRT))            return;          break; -      case LibFunc::floor: -      case LibFunc::floorf: -      case LibFunc::floorl: +      case LibFunc_floor: +      case LibFunc_floorf: +      case LibFunc_floorl:          if (visitUnaryFloatCall(I, ISD::FFLOOR))            return;          break; -      case LibFunc::nearbyint: -      case LibFunc::nearbyintf: -      case LibFunc::nearbyintl: +      case LibFunc_nearbyint: +      case LibFunc_nearbyintf: +      case LibFunc_nearbyintl:          if (visitUnaryFloatCall(I, ISD::FNEARBYINT))            return;          break; -      case LibFunc::ceil: -      case LibFunc::ceilf: -      case LibFunc::ceill: +      case LibFunc_ceil: +      case LibFunc_ceilf: +      case LibFunc_ceill:          if (visitUnaryFloatCall(I, ISD::FCEIL))            return;          break; -      case LibFunc::rint: -      case LibFunc::rintf: -      case LibFunc::rintl: +      case LibFunc_rint: +      case LibFunc_rintf: +      case LibFunc_rintl:          if (visitUnaryFloatCall(I, ISD::FRINT))            return;          break; -      case LibFunc::round: -      case LibFunc::roundf: -      case LibFunc::roundl: +      case LibFunc_round: +      case LibFunc_roundf: +      case LibFunc_roundl:          if (visitUnaryFloatCall(I, ISD::FROUND))            return;          break; -      case LibFunc::trunc: -      case LibFunc::truncf: -      case LibFunc::truncl: +      case LibFunc_trunc: +      case LibFunc_truncf: +      case LibFunc_truncl:          if (visitUnaryFloatCall(I, ISD::FTRUNC))            return;          break; -      case LibFunc::log2: -      case LibFunc::log2f: -      case LibFunc::log2l: +      case LibFunc_log2: +      case LibFunc_log2f: +      case LibFunc_log2l:          if (visitUnaryFloatCall(I, ISD::FLOG2))            return;          break; -      case LibFunc::exp2: -      case LibFunc::exp2f: -      case LibFunc::exp2l: +      case LibFunc_exp2: +      case LibFunc_exp2f: +      case LibFunc_exp2l:          if (visitUnaryFloatCall(I, ISD::FEXP2))            return;          break; -      case LibFunc::memcmp: +      case LibFunc_memcmp:          if (visitMemCmpCall(I))            return;          break; -      case LibFunc::mempcpy: +      case LibFunc_mempcpy:          if (visitMemPCpyCall(I))            return;          break; -      case LibFunc::memchr: +      case LibFunc_memchr:          if (visitMemChrCall(I))            return;          break; -      case LibFunc::strcpy: +      case LibFunc_strcpy:          if (visitStrCpyCall(I, false))            return;          break; -      case LibFunc::stpcpy: +      case LibFunc_stpcpy:          if (visitStrCpyCall(I, true))            return;          break; -      case LibFunc::strcmp: +      case LibFunc_strcmp:          if (visitStrCmpCall(I))            return;          break; -      case LibFunc::strlen: +      case LibFunc_strlen:          if (visitStrLenCall(I))            return;          break; -      case LibFunc::strnlen: +      case LibFunc_strnlen:          if (visitStrNLenCall(I))            return;          break;  | 

