summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_pc.h
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-12 00:46:38 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-12 00:59:49 +0200
commit7a4a537be1460b09b192fdf4d92680aad6c9e951 (patch)
treea87b272fa5da691816ccc5584531f164fbbc85ee /src/gallium/drivers/nv50/nv50_pc.h
parent6997da9f3cf22b9d11ffdfa6ad25b68ef4913fc3 (diff)
nv50: reduce bb_reachable_by runtime from pot to linear
As a by-product, remove the memory leak of nv_basic_blocks.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_pc.h')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h
index ccddae063c..e8d9942307 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -144,6 +144,8 @@
#define NV_PC_MAX_INSTRUCTIONS 2048
#define NV_PC_MAX_VALUES (NV_PC_MAX_INSTRUCTIONS * 4)
+#define NV_PC_MAX_BASIC_BLOCKS 1024
+
static INLINE boolean
nv_is_vector_op(uint opcode)
{
@@ -284,7 +286,7 @@ struct nv_basic_block {
int id;
int subroutine;
- uint priv;
+ uint priv; /* reset to 0 after you're done */
uint pass_seq;
uint32_t bin_pos; /* position, size in emitted code */
@@ -328,7 +330,7 @@ struct nv_pc {
struct nv_value values[NV_PC_MAX_VALUES];
struct nv_instruction instructions[NV_PC_MAX_INSTRUCTIONS];
struct nv_ref **refs;
- struct nv_basic_block **bb_list;
+ struct nv_basic_block *bb_list[NV_PC_MAX_BASIC_BLOCKS];
int num_values;
int num_instructions;
int num_refs;
@@ -437,9 +439,15 @@ new_ref(struct nv_pc *pc, struct nv_value *val)
static INLINE struct nv_basic_block *
new_basic_block(struct nv_pc *pc)
{
- struct nv_basic_block *bb = CALLOC_STRUCT(nv_basic_block);
+ struct nv_basic_block *bb;
+
+ if (pc->num_blocks >= NV_PC_MAX_BASIC_BLOCKS)
+ return NULL;
+
+ bb = CALLOC_STRUCT(nv_basic_block);
- bb->id = pc->num_blocks++;
+ bb->id = pc->num_blocks;
+ pc->bb_list[pc->num_blocks++] = bb;
return bb;
}