mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-28 13:37:57 +03:00
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:
parent
46def3e7e0
commit
c92abba2bb
23 changed files with 2365 additions and 172 deletions
|
@ -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)?;
|
||||
|
|
|
@ -1499,7 +1499,6 @@ derive_parser!(
|
|||
pub enum StateSpace {
|
||||
Reg,
|
||||
Generic,
|
||||
Sreg,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue