diff options
author | Andrzej Janik <[email protected]> | 2024-09-23 16:33:46 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-23 16:33:46 +0200 |
commit | c92abba2bb884a4dba8ca5e3df4d46a30878f27e (patch) | |
tree | 89bab98e3071aedd12f755bfde8a7c7382138ed7 /ptx_parser/src | |
parent | 46def3e7e09dbf4d3e7287a72bfecb73e6e429c5 (diff) | |
download | ZLUDA-c92abba2bb884a4dba8ca5e3df4d46a30878f27e.tar.gz ZLUDA-c92abba2bb884a4dba8ca5e3df4d46a30878f27e.zip |
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
Diffstat (limited to 'ptx_parser/src')
-rw-r--r-- | ptx_parser/src/ast.rs | 30 | ||||
-rw-r--r-- | ptx_parser/src/lib.rs | 1 |
2 files changed, 27 insertions, 4 deletions
diff --git a/ptx_parser/src/ast.rs b/ptx_parser/src/ast.rs index a90b21e..65c624e 100644 --- a/ptx_parser/src/ast.rs +++ b/ptx_parser/src/ast.rs @@ -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)?;
diff --git a/ptx_parser/src/lib.rs b/ptx_parser/src/lib.rs index f842ace..fee11aa 100644 --- a/ptx_parser/src/lib.rs +++ b/ptx_parser/src/lib.rs @@ -1499,7 +1499,6 @@ derive_parser!( pub enum StateSpace { Reg, Generic, - Sreg, } #[derive(Copy, Clone, PartialEq, Eq, Hash)] |