summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-10-09 12:55:31 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-10-09 12:55:31 +0100
commitcc40abad519cc0f765c6d8f6fad4154bed8dd9c2 (patch)
tree86ba36c495c36af191b9b8fe903620fa8b171a9c /src/gallium/auxiliary/gallivm
parent679dd26623a53b5a052845bf4c6aef224cfdd5a2 (diff)
gallivm: Don't generate Phis for execution mask.
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_flow.c28
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_flow.h5
2 files changed, 25 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
index 1ec33c742e..a5d65e9b39 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
@@ -454,12 +454,15 @@ void
lp_build_mask_check(struct lp_build_mask_context *mask)
{
LLVMBuilderRef builder = mask->flow->builder;
+ LLVMValueRef value;
LLVMValueRef cond;
+ value = lp_build_mask_value(mask);
+
/* cond = (mask == 0) */
cond = LLVMBuildICmp(builder,
LLVMIntEQ,
- LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""),
+ LLVMBuildBitCast(builder, value, mask->reg_type, ""),
LLVMConstNull(mask->reg_type),
"");
@@ -485,14 +488,23 @@ lp_build_mask_begin(struct lp_build_mask_context *mask,
mask->flow = flow;
mask->reg_type = LLVMIntType(type.width * type.length);
- mask->value = value;
+ mask->var = lp_build_alloca(flow->builder,
+ lp_build_int_vec_type(type),
+ "execution_mask");
+
+ LLVMBuildStore(flow->builder, value, mask->var);
- lp_build_flow_scope_begin(flow);
- lp_build_flow_scope_declare(flow, &mask->value);
lp_build_flow_skip_begin(flow);
}
+LLVMValueRef
+lp_build_mask_value(struct lp_build_mask_context *mask)
+{
+ return LLVMBuildLoad(mask->flow->builder, mask->var, "");
+}
+
+
/**
* Update boolean mask with given value (bitwise AND).
* Typically used to update the quad's pixel alive/killed mask
@@ -502,7 +514,10 @@ void
lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef value)
{
- mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, "");
+ value = LLVMBuildAnd(mask->flow->builder,
+ lp_build_mask_value(mask),
+ value, "");
+ LLVMBuildStore(mask->flow->builder, value, mask->var);
}
@@ -513,8 +528,7 @@ LLVMValueRef
lp_build_mask_end(struct lp_build_mask_context *mask)
{
lp_build_flow_skip_end(mask->flow);
- lp_build_flow_scope_end(mask->flow);
- return mask->value;
+ return lp_build_mask_value(mask);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
index 095c781ec5..0fc6317b33 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
@@ -77,7 +77,7 @@ struct lp_build_mask_context
LLVMTypeRef reg_type;
- LLVMValueRef value;
+ LLVMValueRef var;
};
@@ -87,6 +87,9 @@ lp_build_mask_begin(struct lp_build_mask_context *mask,
struct lp_type type,
LLVMValueRef value);
+LLVMValueRef
+lp_build_mask_value(struct lp_build_mask_context *mask);
+
/**
* Bitwise AND the mask with the given value, if a previous mask was set.
*/