Skip to content

Commit f40dbbd

Browse files
giordanostaticfloat
andcommitted
Export jl_test_cpu_feature and generate Julia list of CPU features
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
1 parent 608592c commit f40dbbd

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

base/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/features_h.jl
12
/pcre_h.jl
23
/errno_h.jl
34
/build_h.jl

base/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ else
1212
CPP_STDOUT := $(CPP) -E
1313
endif
1414

15-
all: $(addprefix $(BUILDDIR)/,pcre_h.jl errno_h.jl build_h.jl.phony file_constants.jl uv_constants.jl version_git.jl.phony)
15+
all: $(addprefix $(BUILDDIR)/,pcre_h.jl errno_h.jl build_h.jl.phony features_h.jl file_constants.jl uv_constants.jl version_git.jl.phony)
1616

1717
PCRE_CONST := 0x[0-9a-fA-F]+|[0-9]+|\([\-0-9]+\)
1818
ifeq ($(USE_SYSTEM_PCRE), 1)
@@ -21,6 +21,18 @@ else
2121
PCRE_INCL_PATH := $(build_includedir)/pcre2.h
2222
endif
2323

24+
define parse_features
25+
@echo "# $(2) features" >> $@
26+
@$(call PRINT_PERL, cat ../src/features_$(1).h | perl -lne 'print "const JL_$(2)_$$1 = UInt32($$2)" if /^\s*JL_FEATURE_DEF(?:_NAME)?\(\s*(\w+)\s*,\s*([^,]+)\s*,.*\)\s*(?:\/\/.*)?$$/' >> $@)
27+
@echo >> $@
28+
endef
29+
30+
$(BUILDDIR)/features_h.jl: ../src/features_x86.h ../src/features_aarch32.h ../src/features_aarch64.h
31+
@-rm -f $@
32+
@$(call parse_features,x86,X86)
33+
@$(call parse_features,aarch32,AArch32)
34+
@$(call parse_features,aarch64,AArch64)
35+
2436
$(BUILDDIR)/pcre_h.jl: $(PCRE_INCL_PATH)
2537
@$(call PRINT_PERL, $(CPP) -D PCRE2_CODE_UNIT_WIDTH=8 -dM $< | perl -nle '/^\s*#define\s+PCRE2_(\w*)\s*\(?($(PCRE_CONST))\)?u?\s*$$/ and print index($$1, "ERROR_") == 0 ? "const $$1 = Cint($$2)" : "const $$1 = UInt32($$2)"' | LC_ALL=C sort > $@)
2638

@@ -236,6 +248,7 @@ clean:
236248
-rm -f $(BUILDDIR)/errno_h.jl
237249
-rm -f $(BUILDDIR)/build_h.jl
238250
-rm -f $(BUILDDIR)/build_h.jl.phony
251+
-rm -f $(BUILDDIR)/features_h.jl
239252
-rm -f $(BUILDDIR)/uv_constants.jl
240253
-rm -f $(BUILDDIR)/file_constants.jl
241254
-rm -f $(BUILDDIR)/version_git.jl

src/processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ typedef enum {
123123
} jl_cpu_feature_t;
124124
#undef JL_FEATURE_DEF_NAME
125125

126-
int jl_test_cpu_feature(jl_cpu_feature_t feature);
126+
JL_DLLEXPORT int jl_test_cpu_feature(jl_cpu_feature_t feature);
127127

128128
static const uint32_t jl_sysimg_tag_mask = 0x80000000u;
129129
static const uint32_t jl_sysimg_val_mask = ~((uint32_t)0x80000000u);

0 commit comments

Comments
 (0)