mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-26 04:50:41 +01:00
intel/brw: Use brw_analysis prefix for liveness analysis files
Move declaration to the common header and rename definition file. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33048>
This commit is contained in:
parent
e5369540ea
commit
e0614e8ea1
14 changed files with 120 additions and 160 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
* Copyright © 2010-2012 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#include "brw_cfg.h"
|
||||
#include "brw_inst.h"
|
||||
#include "brw_ir_analysis.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_ir_performance.h"
|
||||
#include "util/bitset.h"
|
||||
|
||||
struct fs_visitor;
|
||||
|
||||
|
|
@ -93,4 +93,110 @@ namespace brw {
|
|||
uint32_t *def_use_counts;
|
||||
unsigned def_count;
|
||||
};
|
||||
|
||||
class fs_live_variables {
|
||||
public:
|
||||
struct block_data {
|
||||
/**
|
||||
* Which variables are defined before being used in the block.
|
||||
*
|
||||
* Note that for our purposes, "defined" means unconditionally, completely
|
||||
* defined.
|
||||
*/
|
||||
BITSET_WORD *def;
|
||||
|
||||
/**
|
||||
* Which variables are used before being defined in the block.
|
||||
*/
|
||||
BITSET_WORD *use;
|
||||
|
||||
/** Which defs reach the entry point of the block. */
|
||||
BITSET_WORD *livein;
|
||||
|
||||
/** Which defs reach the exit point of the block. */
|
||||
BITSET_WORD *liveout;
|
||||
|
||||
/**
|
||||
* Variables such that the entry point of the block may be reached from any
|
||||
* of their definitions.
|
||||
*/
|
||||
BITSET_WORD *defin;
|
||||
|
||||
/**
|
||||
* Variables such that the exit point of the block may be reached from any
|
||||
* of their definitions.
|
||||
*/
|
||||
BITSET_WORD *defout;
|
||||
|
||||
BITSET_WORD flag_def[1];
|
||||
BITSET_WORD flag_use[1];
|
||||
BITSET_WORD flag_livein[1];
|
||||
BITSET_WORD flag_liveout[1];
|
||||
};
|
||||
|
||||
fs_live_variables(const fs_visitor *s);
|
||||
~fs_live_variables();
|
||||
|
||||
bool validate(const fs_visitor *s) const;
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return (DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES);
|
||||
}
|
||||
|
||||
bool vars_interfere(int a, int b) const;
|
||||
bool vgrfs_interfere(int a, int b) const;
|
||||
int var_from_reg(const brw_reg ®) const
|
||||
{
|
||||
return var_from_vgrf[reg.nr] + reg.offset / REG_SIZE;
|
||||
}
|
||||
|
||||
/** Map from virtual GRF number to index in block_data arrays. */
|
||||
int *var_from_vgrf;
|
||||
|
||||
/**
|
||||
* Map from any index in block_data to the virtual GRF containing it.
|
||||
*
|
||||
* For alloc.sizes of [1, 2, 3], vgrf_from_var would contain
|
||||
* [0, 1, 1, 2, 2, 2].
|
||||
*/
|
||||
int *vgrf_from_var;
|
||||
|
||||
int num_vars;
|
||||
int num_vgrfs;
|
||||
int bitset_words;
|
||||
|
||||
/** @{
|
||||
* Final computed live ranges for each var (each component of each virtual
|
||||
* GRF).
|
||||
*/
|
||||
int *start;
|
||||
int *end;
|
||||
/** @} */
|
||||
|
||||
/** @{
|
||||
* Final computed live ranges for each VGRF.
|
||||
*/
|
||||
int *vgrf_start;
|
||||
int *vgrf_end;
|
||||
/** @} */
|
||||
|
||||
/** Per-basic-block information on live variables */
|
||||
struct block_data *block_data;
|
||||
|
||||
protected:
|
||||
void setup_def_use();
|
||||
void setup_one_read(struct block_data *bd, int ip, const brw_reg ®);
|
||||
void setup_one_write(struct block_data *bd, brw_inst *inst, int ip,
|
||||
const brw_reg ®);
|
||||
void compute_live_variables();
|
||||
void compute_start_end();
|
||||
|
||||
const struct intel_device_info *devinfo;
|
||||
const cfg_t *cfg;
|
||||
void *mem_ctx;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_analysis.h"
|
||||
|
||||
using namespace brw;
|
||||
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_generator.h"
|
||||
#include "brw_nir.h"
|
||||
#include "brw_cfg.h"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
*/
|
||||
|
||||
#include "brw_fs.h"
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_builder.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_generator.h"
|
||||
#include "brw_nir.h"
|
||||
#include "brw_cfg.h"
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "brw_eu.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_builder.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_generator.h"
|
||||
#include "brw_nir.h"
|
||||
#include "brw_cfg.h"
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
* from the LIR.
|
||||
*/
|
||||
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_eu.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_builder.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_nir.h"
|
||||
#include "brw_cfg.h"
|
||||
#include "brw_rt.h"
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
#include "brw_compiler.h"
|
||||
#include "brw_inst.h"
|
||||
#include "brw_ir_allocator.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_ir_performance.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "brw_analysis.h"
|
||||
|
||||
struct fs_visitor;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Eric Anholt <eric@anholt.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "brw_inst.h"
|
||||
#include "brw_ir_analysis.h"
|
||||
#include "util/bitset.h"
|
||||
|
||||
struct cfg_t;
|
||||
struct fs_visitor;
|
||||
|
||||
namespace brw {
|
||||
|
||||
class fs_live_variables {
|
||||
public:
|
||||
struct block_data {
|
||||
/**
|
||||
* Which variables are defined before being used in the block.
|
||||
*
|
||||
* Note that for our purposes, "defined" means unconditionally, completely
|
||||
* defined.
|
||||
*/
|
||||
BITSET_WORD *def;
|
||||
|
||||
/**
|
||||
* Which variables are used before being defined in the block.
|
||||
*/
|
||||
BITSET_WORD *use;
|
||||
|
||||
/** Which defs reach the entry point of the block. */
|
||||
BITSET_WORD *livein;
|
||||
|
||||
/** Which defs reach the exit point of the block. */
|
||||
BITSET_WORD *liveout;
|
||||
|
||||
/**
|
||||
* Variables such that the entry point of the block may be reached from any
|
||||
* of their definitions.
|
||||
*/
|
||||
BITSET_WORD *defin;
|
||||
|
||||
/**
|
||||
* Variables such that the exit point of the block may be reached from any
|
||||
* of their definitions.
|
||||
*/
|
||||
BITSET_WORD *defout;
|
||||
|
||||
BITSET_WORD flag_def[1];
|
||||
BITSET_WORD flag_use[1];
|
||||
BITSET_WORD flag_livein[1];
|
||||
BITSET_WORD flag_liveout[1];
|
||||
};
|
||||
|
||||
fs_live_variables(const fs_visitor *s);
|
||||
~fs_live_variables();
|
||||
|
||||
bool validate(const fs_visitor *s) const;
|
||||
|
||||
analysis_dependency_class
|
||||
dependency_class() const
|
||||
{
|
||||
return (DEPENDENCY_INSTRUCTION_IDENTITY |
|
||||
DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_VARIABLES);
|
||||
}
|
||||
|
||||
bool vars_interfere(int a, int b) const;
|
||||
bool vgrfs_interfere(int a, int b) const;
|
||||
int var_from_reg(const brw_reg ®) const
|
||||
{
|
||||
return var_from_vgrf[reg.nr] + reg.offset / REG_SIZE;
|
||||
}
|
||||
|
||||
/** Map from virtual GRF number to index in block_data arrays. */
|
||||
int *var_from_vgrf;
|
||||
|
||||
/**
|
||||
* Map from any index in block_data to the virtual GRF containing it.
|
||||
*
|
||||
* For alloc.sizes of [1, 2, 3], vgrf_from_var would contain
|
||||
* [0, 1, 1, 2, 2, 2].
|
||||
*/
|
||||
int *vgrf_from_var;
|
||||
|
||||
int num_vars;
|
||||
int num_vgrfs;
|
||||
int bitset_words;
|
||||
|
||||
/** @{
|
||||
* Final computed live ranges for each var (each component of each virtual
|
||||
* GRF).
|
||||
*/
|
||||
int *start;
|
||||
int *end;
|
||||
/** @} */
|
||||
|
||||
/** @{
|
||||
* Final computed live ranges for each VGRF.
|
||||
*/
|
||||
int *vgrf_start;
|
||||
int *vgrf_end;
|
||||
/** @} */
|
||||
|
||||
/** Per-basic-block information on live variables */
|
||||
struct block_data *block_data;
|
||||
|
||||
protected:
|
||||
void setup_def_use();
|
||||
void setup_one_read(struct block_data *bd, int ip, const brw_reg ®);
|
||||
void setup_one_write(struct block_data *bd, brw_inst *inst, int ip,
|
||||
const brw_reg ®);
|
||||
void compute_live_variables();
|
||||
void compute_start_end();
|
||||
|
||||
const struct intel_device_info *devinfo;
|
||||
const cfg_t *cfg;
|
||||
void *mem_ctx;
|
||||
};
|
||||
|
||||
} /* namespace brw */
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
#include "util/u_math.h"
|
||||
#include "util/rb_tree.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_cfg.h"
|
||||
#include "brw_eu.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_cfg.h"
|
||||
|
||||
/** @file
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@
|
|||
* mul vgrf5:F, vgrf5:F, vgrf4:F
|
||||
*/
|
||||
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_cfg.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
|
||||
using namespace brw;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_cfg.h"
|
||||
|
||||
using namespace brw;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "brw_eu.h"
|
||||
#include "brw_fs.h"
|
||||
#include "brw_fs_live_variables.h"
|
||||
#include "brw_analysis.h"
|
||||
#include "brw_cfg.h"
|
||||
#include <new>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ intel_nir_files = files(
|
|||
|
||||
libintel_compiler_brw_files = files(
|
||||
'brw_analysis.h',
|
||||
'brw_analysis_liveness.cpp',
|
||||
'brw_builder.cpp',
|
||||
'brw_builder.h',
|
||||
'brw_cfg.cpp',
|
||||
|
|
@ -51,8 +52,6 @@ libintel_compiler_brw_files = files(
|
|||
'brw_from_nir.cpp',
|
||||
'brw_fs.cpp',
|
||||
'brw_fs.h',
|
||||
'brw_fs_live_variables.cpp',
|
||||
'brw_fs_live_variables.h',
|
||||
'brw_fs_thread_payload.cpp',
|
||||
'brw_fs_visitor.cpp',
|
||||
'brw_generator.cpp',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue