[LLVMdev] More questions on CompilerDriver.

Mikhail Glushenkov the.dead.shall.rise at gmail.com
Thu Nov 19 12:13:25 PST 2009


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




More information about the llvm-dev mailing list