----- Original Message ----- From: William Chops Westfield To: Microcontroller discussion list - Public. Sent: Thursday, October 07, 2004 4:48 PM Subject: Re: [PIC] new optimisation in XCSB > On Oct 6, 2004, at 11:34 PM, piclist@xargs.com wrote: > > > > >> and define functions? It's a substantial accomplishment, IMO... > > > > The functions were "inline", so they're probably interpreted more like > > C macros than functions. > > Agreed, if xcsb processes "inline" functions the same as C macros, > it's less impressive. I don't know if that's the case... No xcsb does not treat inline functions the same as C macros. xcsb uses an inline function as a template to generate specialised code at the point where it is invoked. The use of the formal parameters within the function and the actual parameters at the point of invokation determin how the code is generated. e.g. in C #define max(a,b) (a > b ? a : b) c = max(d+=1, 5); is equivalent to c = (d+=1 > 5 ? d+=1 : 5) in xcsb proc inline int max(int a, int b) if a > b then return a else return b endif endproc c = max(d+=1, 5); is equivalent to arg0 = d+=1 if arg0 > 5 then c = arg0 else c = 5 endif > > > > > But something like this: > > > > #define TEST_BIT(port, bit) (((port) & (1 << ((bit) & 7))) != 0) > > What does your C compiler do if you use a C inline function instead > of a macro? > > I guess, one of the (main?) impressive things is getting the info > that the expressions are constants across that function call boundry. > If inline functions are just macro-like, that's not such a big deal. > If they're really inline functions (and my compiler internals > expertise isn't enough to list all the ways that's different), then > it IS a pretty big deal... > > BillW Regards Sergio Masci http://www.xcprod.com/titan/XCSB - optimising PIC compiler _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist