Hi Mikhail, I was trying to figure out how to do the following in compiler driver. 1. mcc16 driver has a -p <device_name> option. Now from this device_name I want to be able to construct a file name like "device_name.o" and pass that to the linker. Unpack_values "p" gives me the device_name, but I do not know how to add ".o" suffix to it. something like: (not_empty "p"), [ (unpack_values "p"), (append_cmd ".o")] 2. Is there anyway to call a C++ hook from inside actions? for example (actions (case (not_empty "Wl,"), (append_cmd "$CALL(Myhook)" ))) Thanks in advance. - Sanjiv
Hi Sanjiv, On Thu, Nov 19, 2009 at 5:07 AM, Sanjiv Gupta <sanjiv.gupta at microchip.com> wrote:> Hi Mikhail, > > I was trying to figure out how to do the following in compiler driver. > > 1. mcc16 driver has a -p <device_name> option. Now from this device_name I > want to be able to construct a file name like "device_name.o" and pass that > to the linker. Unpack_values "p" gives me the device_name, but I do not know > how to add ".o" suffix to it. > > something like: > (not_empty "p"), [ (unpack_values "p"), (append_cmd ".o")]If the set of device_names is not large, you can work around this for now by creating a separate linker tool for each device_name (should be easy with inheritance) and then using OptionalEdges to choose the right "linker". A better solution is to add a 'forward_processed_value' action of the form '(forward_processed_value "opt-name" "HookName")'. Or maybe even '(forward_transformed_value "p" "$VAL.o")'. Ideally, I'd like to make primitive actions composable, so that it'd possible to write something like '(forward (apply_hook "HookName" (get_value "p")))', but it's not especially fun to implement this on top of TableGen...> 2. Is there anyway to call a C++ hook from inside actions? > for example > (actions (case > (not_empty "Wl,"), (append_cmd "$CALL(Myhook)" )))Not yet, this is something I'm working on right now. BTW, I've implemented the OptionPreprocessor feature that we discussed some time ago. See the documentation for details. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
Mikhail Glushenkov wrote:> Hi Sanjiv, > > On Thu, Nov 19, 2009 at 5:07 AM, Sanjiv Gupta > <sanjiv.gupta at microchip.com> wrote: > >> Hi Mikhail, >> >> I was trying to figure out how to do the following in compiler driver. >> >> 1. mcc16 driver has a -p <device_name> option. Now from this device_name I >> want to be able to construct a file name like "device_name.o" and pass that >> to the linker. Unpack_values "p" gives me the device_name, but I do not know >> how to add ".o" suffix to it. >> >> something like: >> (not_empty "p"), [ (unpack_values "p"), (append_cmd ".o")] >> > > If the set of device_names is not large, you can work around this for > now by creating a separate linker tool for each device_name (should be > easy with inheritance) and then using OptionalEdges to choose the > right "linker". > > A better solution is to add a 'forward_processed_value' action of the > form '(forward_processed_value "opt-name" "HookName")'. Or maybe even > '(forward_transformed_value "p" "$VAL.o")'. > >The set is large. But I think 'forward_transformed_value' should do. Anywasy, we fixed this in our linker itself currently.> Ideally, I'd like to make primitive actions composable, so that it'd > possible to write something like '(forward (apply_hook "HookName" > (get_value "p")))', but it's not especially fun to implement this on > top of TableGen... > > >> 2. Is there anyway to call a C++ hook from inside actions? >> for example >> (actions (case >> (not_empty "Wl,"), (append_cmd "$CALL(Myhook)" ))) >> > > Not yet, this is something I'm working on right now. >That would be great. This is something we want to use for doing some special kind processing when -O1 or -O2 is specified.> BTW, I've implemented the OptionPreprocessor feature that we discussed > some time ago. See the documentation for details. > >Yes, I saw the document already. And that looks really good. Thanks for the same. - Sanjiv
Mikhail Glushenkov wrote:> > > 2. Is there anyway to call a C++ hook from inside actions? > > for example > > (actions (case > > (not_empty "Wl,"), (append_cmd "$CALL(Myhook)" ))) > > Not yet, this is something I'm working on right now. >Hi Mikhail, Did you get a chance to do something about this?> > > BTW, I've implemented the OptionPreprocessor feature that we discussed > some time ago. See the documentation for details. >is it a good idea to include something called "set_option"? For example if none of O0, O1, O2 or O3 are specified on the command line, We can just make O2 as default by using the set_option. - Sanjiv> -- > () ascii ribbon campaign - against html e-mail > /\ www.asciiribbon.org - against proprietary attachments >