Related articles |
---|
Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-17) |
Re: Optimizing nested if statements? christian.bau@cbau.freeserve.co.uk (Christian Bau) (2003-01-21) |
Re: Optimizing nested if statements? terryg@qwest.net (Terry Greyzck) (2003-01-21) |
Re: Optimizing nested if statements? vbdis@aol.com (2003-01-21) |
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-25) |
Re: Optimizing nested if statements? Martin.Ward@durham.ac.uk (2003-01-26) |
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-02-06) |
From: | Saverio Perugini <sperugin@csgrad.cs.vt.edu> |
Newsgroups: | comp.compilers |
Date: | 17 Jan 2003 23:13:46 -0500 |
Organization: | Virginia Tech, Blacksburg, Virginia, USA |
Keywords: | optimize, question |
Posted-Date: | 17 Jan 2003 23:13:46 EST |
Hello,
Consider the following code:
if (a) {
if (b) {
if (c) {
...
} else if (d) {
...
}
}
} else if (e) {
...
}
This code is semantically equivalent to
the following piece of code.
if (a) {
if (b && c) {
...
} else if (d) {
...
}
} else if (e) {
...
}
Is there a program-theoretic operation (e.g., partial evaluation) or
compiler optimization which will perform this (syntax-to-syntax)
transformation automatically? I want to collapse/consolidate
consecutive single variable conditional expressions, where possible
(i.e., when the conditional does not have an else clause; e.g., the if
(b) clause above).
Thank You and Best Regards,
Saverio Perugini
Return to the
comp.compilers page.
Search the
comp.compilers archives again.