当前位置: 首页>>代码示例>>C++>>正文


C++ TargetInfo::getInt64Type方法代码示例

本文整理汇总了C++中TargetInfo::getInt64Type方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetInfo::getInt64Type方法的具体用法?C++ TargetInfo::getInt64Type怎么用?C++ TargetInfo::getInt64Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TargetInfo的用法示例。


在下文中一共展示了TargetInfo::getInt64Type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DefineExactWidthIntTypeSize

static void DefineExactWidthIntTypeSize(TargetInfo::IntType Ty,
                                        const TargetInfo &TI,
                                        MacroBuilder &Builder) {
  int TypeWidth = TI.getTypeWidth(Ty);
  bool IsSigned = TI.isTypeSigned(Ty);

  // Use the target specified int64 type, when appropriate, so that [u]int64_t
  // ends up being defined in terms of the correct type.
  if (TypeWidth == 64)
    Ty = IsSigned ? TI.getInt64Type() : TI.getUInt64Type();

  const char *Prefix = IsSigned ? "__INT" : "__UINT";
  DefineTypeSize(Prefix + Twine(TypeWidth) + "_MAX__", Ty, TI, Builder);
}
开发者ID:OpenKimono,项目名称:clang,代码行数:14,代码来源:InitPreprocessor.cpp

示例2: DefineExactWidthIntType

static void DefineExactWidthIntType(TargetInfo::IntType Ty, 
                               const TargetInfo &TI, MacroBuilder &Builder) {
  int TypeWidth = TI.getTypeWidth(Ty);

  // Use the target specified int64 type, when appropriate, so that [u]int64_t
  // ends up being defined in terms of the correct type.
  if (TypeWidth == 64)
    Ty = TI.getInt64Type();

  DefineType("__INT" + Twine(TypeWidth) + "_TYPE__", Ty, Builder);

  StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty));
  if (!ConstSuffix.empty())
    Builder.defineMacro("__INT" + Twine(TypeWidth) + "_C_SUFFIX__",
                        ConstSuffix);
}
开发者ID:clawplach,项目名称:duetto-clang,代码行数:16,代码来源:InitPreprocessor.cpp

示例3: DefineExactWidthIntType

static void DefineExactWidthIntType(TargetInfo::IntType Ty,
                                    const TargetInfo &TI,
                                    MacroBuilder &Builder) {
  int TypeWidth = TI.getTypeWidth(Ty);
  bool IsSigned = TI.isTypeSigned(Ty);

  // Use the target specified int64 type, when appropriate, so that [u]int64_t
  // ends up being defined in terms of the correct type.
  if (TypeWidth == 64)
    Ty = IsSigned ? TI.getInt64Type() : TI.getIntTypeByWidth(64, false);

  const char *Prefix = IsSigned ? "__INT" : "__UINT";

  DefineType(Prefix + Twine(TypeWidth) + "_TYPE__", Ty, Builder);

  StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty));
  if (!ConstSuffix.empty())
    Builder.defineMacro(Prefix + Twine(TypeWidth) + "_C_SUFFIX__", ConstSuffix);

}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_clang,代码行数:20,代码来源:InitPreprocessor.cpp

示例4: InitializePredefinedMacros


//.........这里部分代码省略.........
        IntMaxWidth = TI.getLongWidth();
        IntMaxSuffix = "L";
    } else {
        assert(TI.getIntMaxType() == TargetInfo::SignedInt);
        IntMaxWidth = TI.getIntWidth();
        IntMaxSuffix = "";
    }

    DefineTypeSize("__SCHAR_MAX__", TI.getCharWidth(), "", true, Buf);
    DefineTypeSize("__SHRT_MAX__", TI.getShortWidth(), "", true, Buf);
    DefineTypeSize("__INT_MAX__", TI.getIntWidth(), "", true, Buf);
    DefineTypeSize("__LONG_MAX__", TI.getLongWidth(), "L", true, Buf);
    DefineTypeSize("__LONG_LONG_MAX__", TI.getLongLongWidth(), "LL", true, Buf);
    DefineTypeSize("__WCHAR_MAX__", TI.getWCharWidth(), "", true, Buf);
    DefineTypeSize("__INTMAX_MAX__", IntMaxWidth, IntMaxSuffix, true, Buf);

    DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Buf);
    DefineType("__UINTMAX_TYPE__", TI.getUIntMaxType(), Buf);
    DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(0), Buf);
    DefineType("__INTPTR_TYPE__", TI.getIntPtrType(), Buf);
    DefineType("__SIZE_TYPE__", TI.getSizeType(), Buf);
    DefineType("__WCHAR_TYPE__", TI.getWCharType(), Buf);
    // FIXME: TargetInfo hookize __WINT_TYPE__.
    DefineBuiltinMacro(Buf, "__WINT_TYPE__=int");

    DefineFloatMacros(Buf, "FLT", &TI.getFloatFormat());
    DefineFloatMacros(Buf, "DBL", &TI.getDoubleFormat());
    DefineFloatMacros(Buf, "LDBL", &TI.getLongDoubleFormat());

    // Define a __POINTER_WIDTH__ macro for stdint.h.
    sprintf(MacroBuf, "__POINTER_WIDTH__=%d", (int)TI.getPointerWidth(0));
    DefineBuiltinMacro(Buf, MacroBuf);

    if (!LangOpts.CharIsSigned)
        DefineBuiltinMacro(Buf, "__CHAR_UNSIGNED__");

    // Define fixed-sized integer types for stdint.h
    assert(TI.getCharWidth() == 8 && "unsupported target types");
    assert(TI.getShortWidth() == 16 && "unsupported target types");
    DefineBuiltinMacro(Buf, "__INT8_TYPE__=char");
    DefineBuiltinMacro(Buf, "__INT16_TYPE__=short");

    if (TI.getIntWidth() == 32)
        DefineBuiltinMacro(Buf, "__INT32_TYPE__=int");
    else {
        assert(TI.getLongLongWidth() == 32 && "unsupported target types");
        DefineBuiltinMacro(Buf, "__INT32_TYPE__=long long");
    }

    // 16-bit targets doesn't necessarily have a 64-bit type.
    if (TI.getLongLongWidth() == 64)
        DefineType("__INT64_TYPE__", TI.getInt64Type(), Buf);

    // Add __builtin_va_list typedef.
    {
        const char *VAList = TI.getVAListDeclaration();
        Buf.insert(Buf.end(), VAList, VAList+strlen(VAList));
        Buf.push_back('\n');
    }

    if (const char *Prefix = TI.getUserLabelPrefix()) {
        sprintf(MacroBuf, "__USER_LABEL_PREFIX__=%s", Prefix);
        DefineBuiltinMacro(Buf, MacroBuf);
    }

    // Build configuration options.  FIXME: these should be controlled by
    // command line options or something.
    DefineBuiltinMacro(Buf, "__FINITE_MATH_ONLY__=0");

    if (LangOpts.GNUInline)
        DefineBuiltinMacro(Buf, "__GNUC_GNU_INLINE__=1");
    else
        DefineBuiltinMacro(Buf, "__GNUC_STDC_INLINE__=1");

    if (LangOpts.NoInline)
        DefineBuiltinMacro(Buf, "__NO_INLINE__=1");

    if (unsigned PICLevel = LangOpts.PICLevel) {
        sprintf(MacroBuf, "__PIC__=%d", PICLevel);
        DefineBuiltinMacro(Buf, MacroBuf);

        sprintf(MacroBuf, "__pic__=%d", PICLevel);
        DefineBuiltinMacro(Buf, MacroBuf);
    }

    // Macros to control C99 numerics and <float.h>
    DefineBuiltinMacro(Buf, "__FLT_EVAL_METHOD__=0");
    DefineBuiltinMacro(Buf, "__FLT_RADIX__=2");
    sprintf(MacroBuf, "__DECIMAL_DIG__=%d",
            PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33, 36));
    DefineBuiltinMacro(Buf, MacroBuf);

    if (LangOpts.getStackProtectorMode() == LangOptions::SSPOn)
        DefineBuiltinMacro(Buf, "__SSP__=1");
    else if (LangOpts.getStackProtectorMode() == LangOptions::SSPReq)
        DefineBuiltinMacro(Buf, "__SSP_ALL__=2");

    // Get other target #defines.
    TI.getTargetDefines(LangOpts, Buf);
}
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:101,代码来源:InitPreprocessor.cpp


注:本文中的TargetInfo::getInt64Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。