nak: Move bitset to compiler crate

This commit intorduces src/compiler/rust crate, which will have
different modules that help to write a backend compiler in Rust.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30443>
This commit is contained in:
Christian Gmeiner
2024-07-24 14:23:31 +02:00
committed by Marge Bot
parent 6bba7b685e
commit 05bf03c3db
13 changed files with 39 additions and 8 deletions

View File

@@ -70,3 +70,7 @@ if with_gallium
subdir('glsl')
endif
subdir('isaspec')
if with_nouveau_vk
subdir('rust')
endif

View File

@@ -0,0 +1 @@
max_width = 80

4
src/compiler/rust/lib.rs Normal file
View File

@@ -0,0 +1,4 @@
// Copyright © 2024 Igalia S.L.
// SPDX-License-Identifier: MIT
pub mod bitset;

View File

@@ -0,0 +1,23 @@
# Copyright © 2024 Igalia S.L.
# SPDX-License-Identifier: MIT
_compiler_rs_sources = [
'bitset.rs',
]
_compiler_rs_sources = structured_sources([
# lib.rs has to go first
'lib.rs',
_compiler_rs_sources,
])
_libcompiler_rs = static_library(
'compiler',
_compiler_rs_sources,
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
)
idep_compiler_rs = declare_dependency(
link_with : _libcompiler_rs,
)

View File

@@ -143,6 +143,7 @@ _libnak_rs = static_library(
],
dependencies : [
dep_paste,
idep_compiler_rs,
idep_nvidia_headers_rs,
],
link_with : [

View File

@@ -2,10 +2,10 @@
// SPDX-License-Identifier: MIT
use crate::api::{GetDebugFlags, DEBUG};
use crate::bitset::BitSet;
use crate::ir::*;
use crate::liveness::{BlockLiveness, Liveness, SimpleLiveness};
use compiler::bitset::BitSet;
use std::cmp::{max, Ordering};
use std::collections::{HashMap, HashSet};

View File

@@ -1,8 +1,7 @@
// Copyright © 2023 Collabora, Ltd.
// SPDX-License-Identifier: MIT
use crate::bitset::BitSet;
use compiler::bitset::BitSet;
use std::collections::HashMap;
use std::hash::Hash;
use std::ops::{Deref, DerefMut, Index, IndexMut};

View File

@@ -3,7 +3,6 @@
mod api;
mod assign_regs;
mod bitset;
mod builder;
mod calc_instr_deps;
mod cfg;

View File

@@ -1,9 +1,9 @@
// Copyright © 2022 Collabora, Ltd.
// SPDX-License-Identifier: MIT
use crate::bitset::BitSet;
use crate::ir::*;
use compiler::bitset::BitSet;
use std::cell::RefCell;
use std::cmp::{max, Ord, Ordering};
use std::collections::{hash_set, HashMap, HashSet};

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: MIT
use crate::api::{GetDebugFlags, DEBUG};
use crate::bitset::BitSet;
use crate::ir::*;
use compiler::bitset::BitSet;
use std::collections::HashMap;
struct PhiMap {

View File

@@ -1,10 +1,10 @@
// Copyright © 2023 Collabora, Ltd.
// SPDX-License-Identifier: MIT
use crate::bitset::BitSet;
use crate::ir::*;
use crate::union_find::UnionFind;
use compiler::bitset::BitSet;
use std::cell::RefCell;
use std::collections::HashMap;

View File

@@ -4,12 +4,12 @@
#![allow(unstable_name_collisions)]
use crate::api::{GetDebugFlags, DEBUG};
use crate::bitset::BitSet;
use crate::ir::*;
use crate::liveness::{
BlockLiveness, LiveSet, Liveness, NextUseBlockLiveness, NextUseLiveness,
};
use compiler::bitset::BitSet;
use std::cell::RefCell;
use std::cmp::{max, Ordering, Reverse};
use std::collections::{BinaryHeap, HashMap, HashSet};