Add a number of symbol names to list to make internal after loading builtins.

Fixes issue #131; because they weren't being marked as internal before, when
compiling to multiple targets these would lead to multiply-defined symbols.
This commit is contained in:
Matt Pharr
2011-12-07 08:30:38 -08:00
parent eaaebf7928
commit a79bc75b72
5 changed files with 14 additions and 6 deletions

View File

@@ -301,7 +301,7 @@ define i32 @__movmsk(<8 x i32>) nounwind readnone alwaysinline {
} }
define <4 x float> @__vec4_add_float(<4 x float> %v0, define <4 x float> @__vec4_add_float(<4 x float> %v0,
<4 x float> %v1) nounwind readnone alwaysinline { <4 x float> %v1) nounwind readnone alwaysinline {
%v = fadd <4 x float> %v0, %v1 %v = fadd <4 x float> %v0, %v1
ret <4 x float> %v ret <4 x float> %v
} }
@@ -325,7 +325,7 @@ define float @__reduce_max_float(<8 x float>) nounwind readnone alwaysinline {
; helper function for reduce_add_int32 ; helper function for reduce_add_int32
define <4 x i32> @__vec4_add_int32(<4 x i32> %v0, define <4 x i32> @__vec4_add_int32(<4 x i32> %v0,
<4 x i32> %v1) nounwind readnone alwaysinline { <4 x i32> %v1) nounwind readnone alwaysinline {
%v = add <4 x i32> %v0, %v1 %v = add <4 x i32> %v0, %v1
ret <4 x i32> %v ret <4 x i32> %v
} }

View File

@@ -144,7 +144,7 @@ define <4 x double> @__ceil_varying_double(<4 x double>) nounwind readonly alway
; from %1, and otherwise return the value from %0. ; from %1, and otherwise return the value from %0.
define <4 x i32> @__vselect_i32(<4 x i32>, <4 x i32> , define <4 x i32> @__vselect_i32(<4 x i32>, <4 x i32> ,
<4 x i32> %mask) nounwind readnone alwaysinline { <4 x i32> %mask) nounwind readnone alwaysinline {
%notmask = xor <4 x i32> %mask, <i32 -1, i32 -1, i32 -1, i32 -1> %notmask = xor <4 x i32> %mask, <i32 -1, i32 -1, i32 -1, i32 -1>
%cleared_old = and <4 x i32> %0, %notmask %cleared_old = and <4 x i32> %0, %notmask
%masked_new = and <4 x i32> %1, %mask %masked_new = and <4 x i32> %1, %mask
@@ -153,7 +153,7 @@ define <4 x i32> @__vselect_i32(<4 x i32>, <4 x i32> ,
} }
define <4 x float> @__vselect_float(<4 x float>, <4 x float>, define <4 x float> @__vselect_float(<4 x float>, <4 x float>,
<4 x i32> %mask) nounwind readnone alwaysinline { <4 x i32> %mask) nounwind readnone alwaysinline {
%v0 = bitcast <4 x float> %0 to <4 x i32> %v0 = bitcast <4 x float> %0 to <4 x i32>
%v1 = bitcast <4 x float> %1 to <4 x i32> %v1 = bitcast <4 x float> %1 to <4 x i32>
%r = call <4 x i32> @__vselect_i32(<4 x i32> %v0, <4 x i32> %v1, <4 x i32> %mask) %r = call <4 x i32> @__vselect_i32(<4 x i32> %v0, <4 x i32> %v1, <4 x i32> %mask)

View File

@@ -252,7 +252,7 @@ define float @__reduce_max_float(<8 x float>) nounwind readnone alwaysinline {
; helper function for reduce_add_int32 ; helper function for reduce_add_int32
define <4 x i32> @__vec4_add_int32(<4 x i32> %v0, define <4 x i32> @__vec4_add_int32(<4 x i32> %v0,
<4 x i32> %v1) nounwind readnone alwaysinline { <4 x i32> %v1) nounwind readnone alwaysinline {
%v = add <4 x i32> %v0, %v1 %v = add <4 x i32> %v0, %v1
ret <4 x i32> %v ret <4 x i32> %v
} }

View File

@@ -311,8 +311,12 @@ lCheckModuleIntrinsics(llvm::Module *module) {
static void static void
lSetInternalFunctions(llvm::Module *module) { lSetInternalFunctions(llvm::Module *module) {
const char *names[] = { const char *names[] = {
"__add_float",
"__add_int32",
"__add_uniform_double",
"__add_uniform_int32", "__add_uniform_int32",
"__add_uniform_int64", "__add_uniform_int64",
"__add_varying_double",
"__add_varying_int32", "__add_varying_int32",
"__add_varying_int64", "__add_varying_int64",
"__aos_to_soa3_float", "__aos_to_soa3_float",
@@ -543,6 +547,10 @@ lSetInternalFunctions(llvm::Module *module) {
"__svml_pow", "__svml_pow",
"__undef_uniform", "__undef_uniform",
"__undef_varying", "__undef_varying",
"__vec4_add_float",
"__vec4_add_int32",
"__vselect_float",
"__vselect_i32",
}; };
int count = sizeof(names) / sizeof(names[0]); int count = sizeof(names) / sizeof(names[0]);

View File

@@ -3157,7 +3157,7 @@ IndexExpr::GetLValue(FunctionEmitContext *ctx) const {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
if (indices[i] < 0 || indices[i] >= nElements) if (indices[i] < 0 || indices[i] >= nElements)
Warning(index->pos, "Array index \"%d\" may be out of bounds for " Warning(index->pos, "Array index \"%d\" may be out of bounds for "
"\"%d\" element array.", indices[i], nElements); "%d element array.", indices[i], nElements);
} }
} }
} }