Re: [C--] bool and bits1

Ning Wang <[email protected]> Sun, 22 Mar 2009 00:35:50 -0700
Newsgroups gmane.comp.lang.c--
Message-ID <[email protected]>
Norman Ramsey wrote:
>  > it's not possible to allocate temporary variables of bool to
>  > simplify complicate predicate/logic expressions to three address
>  > forms.
>
> If you are using C--, there is no reason for you to do so --- you
> would simply be duplicating the work of the C-- compiler.
>   
Yes, After reading Dias' dissertation, I realize that an optimal 
front-end for C-- is not to simplify  complex expressions if it's not 
neccessary. But simply simplifying all complex expressions are much 
easier to implement.   I guess I'm probably not the only one does so.  
Doing so might has some benefits. I don't have empirical data yet, but I 
believe it can expose more common subexpressions, and enable more 
optimization. 
> If your front end insists on simplifying boolean expressions, than
> your front end should compile them as lcc does, to conditional branches.
>
>  > 1. Why there is no bool type in the C-- grammar, but the semantics of 
>  > C-- has bool type? allowing bool type would eliminate the above 
>  > redundant  type conversions.
>  > 
>  > 2. I guess most of the use of bits1 is like the above case.  Any 
>  > exception?  Why bool and bits1 are not equivalent types?
>
> bits1 is for values and bool is for control flow.
> They are handled differently in the back end.
>   
bool type is not uncommon in high level programming languages.  How does 
it map to a C-- type?  Without bool type in C--, a bool type has to be 
converted to bits1 and then convert back later.

Thanks,
Ning
_______________________________________________
Cminusminus mailing list
[email protected]
https://www.eecs.harvard.edu/mailman/listinfo/cminusminus