Refactor compilation passes (#270)

The overarching goal is to refactor all passes so they are module-scoped and not function-scoped. Additionally, make improvements to the most egregiously buggy/unfit passes (so the code is ready for the next major features: linking, ftz handling) and continue adding more code to the LLVM backend
This commit is contained in:
Andrzej Janik 2024-09-23 16:33:46 +02:00 committed by GitHub
parent 46def3e7e0
commit c92abba2bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 2365 additions and 172 deletions

View file

@ -1049,6 +1049,15 @@ impl<'input, ID> MethodName<'input, ID> {
}
}
impl<'input> MethodName<'input, &'input str> {
pub fn text(&self) -> &'input str {
match self {
MethodName::Kernel(name) => *name,
MethodName::Func(name) => *name,
}
}
}
bitflags! {
pub struct LinkingDirective: u8 {
const NONE = 0b000;
@ -1291,7 +1300,12 @@ impl<T: Operand> CallArgs<T> {
.iter()
.zip(details.return_arguments.iter())
{
visitor.visit_ident(param, Some((type_, *space)), true, false)?;
visitor.visit_ident(
param,
Some((type_, *space)),
*space == StateSpace::Reg,
false,
)?;
}
visitor.visit_ident(&self.func, None, false, false)?;
for (param, (type_, space)) in self
@ -1315,7 +1329,12 @@ impl<T: Operand> CallArgs<T> {
.iter_mut()
.zip(details.return_arguments.iter())
{
visitor.visit_ident(param, Some((type_, *space)), true, false)?;
visitor.visit_ident(
param,
Some((type_, *space)),
*space == StateSpace::Reg,
false,
)?;
}
visitor.visit_ident(&mut self.func, None, false, false)?;
for (param, (type_, space)) in self
@ -1339,7 +1358,12 @@ impl<T: Operand> CallArgs<T> {
.into_iter()
.zip(details.return_arguments.iter())
.map(|(param, (type_, space))| {
visitor.visit_ident(param, Some((type_, *space)), true, false)
visitor.visit_ident(
param,
Some((type_, *space)),
*space == StateSpace::Reg,
false,
)
})
.collect::<Result<Vec<_>, _>>()?;
let func = visitor.visit_ident(self.func, None, false, false)?;

View file

@ -1499,7 +1499,6 @@ derive_parser!(
pub enum StateSpace {
Reg,
Generic,
Sreg,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash)]