From 18ef47001befbd3dfe92187aeea109aea095275c Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Thu, 17 Oct 2019 03:25:18 -0700 Subject: [PATCH] [cxx] Int vs. enum, static for efficiency, cleanup, fix typo. (mono/mono#17377) [cxx] Int vs. enum, static for efficiency, cleanup, fix typo. Commit migrated from https://github.com/mono/mono/commit/e8b6fcc9451eded4ba370649bcb41fad405f0b2a --- src/mono/mono/arch/x86/x86-codegen.h | 2 +- src/mono/mono/metadata/assembly-internals.h | 2 +- src/mono/mono/mini/mini-llvm.c | 46 ++++++++++++++--------------- src/mono/mono/mini/mini.h | 2 ++ 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/mono/mono/arch/x86/x86-codegen.h b/src/mono/mono/arch/x86/x86-codegen.h index 9fd6523..86a051c 100644 --- a/src/mono/mono/arch/x86/x86-codegen.h +++ b/src/mono/mono/arch/x86/x86-codegen.h @@ -1114,7 +1114,7 @@ mono_x86_patch_inline (guchar* code, gpointer target) } while (0) /* - * Note: x86_clear_reg () chacnges the condition code! + * Note: x86_clear_reg () changes the condition code. */ #define x86_clear_reg(inst,reg) x86_alu_reg_reg((inst), X86_XOR, (reg), (reg)) diff --git a/src/mono/mono/metadata/assembly-internals.h b/src/mono/mono/metadata/assembly-internals.h index 96e7da3..7d9a0da 100644 --- a/src/mono/mono/metadata/assembly-internals.h +++ b/src/mono/mono/metadata/assembly-internals.h @@ -31,7 +31,7 @@ typedef enum { MONO_ANAME_EQ_MASK = 0x7 } MonoAssemblyNameEqFlags; -G_ENUM_FUNCTIONS (MonoAssemblyNameEqFlags); +G_ENUM_FUNCTIONS (MonoAssemblyNameEqFlags) void mono_assembly_name_free_internal (MonoAssemblyName *aname); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 9b784a5..449e57b 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -6888,7 +6888,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) case OP_PCMPGTB: { LLVMValueRef pcmp; LLVMTypeRef retType; - int cmpOp; + LLVMIntPredicate cmpOp; if (ins->opcode == OP_PCMPGTB) cmpOp = LLVMIntSGT; @@ -10705,29 +10705,27 @@ static MonoCPUFeatures cpu_features; MonoCPUFeatures mono_llvm_get_cpu_features (void) { - if (cpu_features == 0) { - CpuFeatureAliasFlag flags_map [] = { + static const CpuFeatureAliasFlag flags_map [] = { #if defined(TARGET_X86) || defined(TARGET_AMD64) - { "sse", MONO_CPU_X86_SSE }, - { "sse2", MONO_CPU_X86_SSE2 }, - { "pclmul", MONO_CPU_X86_PCLMUL }, - { "aes", MONO_CPU_X86_AES }, - { "sse2", MONO_CPU_X86_SSE2 }, - { "sse3", MONO_CPU_X86_SSE3 }, - { "ssse3", MONO_CPU_X86_SSSE3 }, - { "sse4.1", MONO_CPU_X86_SSE41 }, - { "sse4.2", MONO_CPU_X86_SSE42 }, - { "popcnt", MONO_CPU_X86_POPCNT }, - { "avx", MONO_CPU_X86_AVX }, - { "avx2", MONO_CPU_X86_AVX2 }, - { "fma", MONO_CPU_X86_FMA }, - { "lzcnt", MONO_CPU_X86_LZCNT }, - { "bmi", MONO_CPU_X86_BMI1 }, - { "bmi2", MONO_CPU_X86_BMI2 }, + { "sse", MONO_CPU_X86_SSE }, + { "sse2", MONO_CPU_X86_SSE2 }, + { "pclmul", MONO_CPU_X86_PCLMUL }, + { "aes", MONO_CPU_X86_AES }, + { "sse2", MONO_CPU_X86_SSE2 }, + { "sse3", MONO_CPU_X86_SSE3 }, + { "ssse3", MONO_CPU_X86_SSSE3 }, + { "sse4.1", MONO_CPU_X86_SSE41 }, + { "sse4.2", MONO_CPU_X86_SSE42 }, + { "popcnt", MONO_CPU_X86_POPCNT }, + { "avx", MONO_CPU_X86_AVX }, + { "avx2", MONO_CPU_X86_AVX2 }, + { "fma", MONO_CPU_X86_FMA }, + { "lzcnt", MONO_CPU_X86_LZCNT }, + { "bmi", MONO_CPU_X86_BMI1 }, + { "bmi2", MONO_CPU_X86_BMI2 }, #endif - }; - cpu_features = mono_llvm_check_cpu_features (flags_map, sizeof (flags_map) / sizeof (CpuFeatureAliasFlag)); - cpu_features |= MONO_CPU_INITED; - } + }; + if (!cpu_features) + cpu_features = MONO_CPU_INITED | (MonoCPUFeatures)mono_llvm_check_cpu_features (flags_map, G_N_ELEMENTS (flags_map)); return cpu_features; -} \ No newline at end of file +} diff --git a/src/mono/mono/mini/mini.h b/src/mono/mono/mini/mini.h index 7305a8b..0bb8e4e 100644 --- a/src/mono/mono/mini/mini.h +++ b/src/mono/mono/mini/mini.h @@ -2846,6 +2846,8 @@ typedef enum { #endif } MonoCPUFeatures; +G_ENUM_FUNCTIONS (MonoCPUFeatures) + MonoCPUFeatures mini_get_cpu_features (MonoCompile* cfg); enum { -- 2.7.4