[LLVMdev] getModuleIdentifier() returns <stdin>

John Criswell criswell at cs.uiuc.edu
Tue Nov 18 07:51:05 PST 2008


Jack Tzu-Han Hung wrote:
> Hi John,
>
> I run my pass this way:
>
> opt -mypass <input.bc >output.bc
>
> So I think "input.bc" is what I should expect, right?
>   
You're telling the shell to pipe input.bc into the standard input of 
opt.  The opt program never sees the filename.

Instead, do this:

opt -mypass input.bc -f -o output.bc

This passes the filename on opt's command line.  opt will open the file 
on its own, and then the Module should get a name similar to that of the 
file from which it came.

-- John T.

> Thanks,
> Jack
>
>
> On Tue, Nov 18, 2008 at 10:23 AM, John Criswell <criswell at cs.uiuc.edu<mailto:criswell at cs.uiuc.edu>> wrote:
> Jack Tzu-Han Hung wrote:
>   
>> Hi all,
>>
>> I'm writing my own pass and use "opt" to launch it. In my pass, I'd like to see the name of the module I'm working on, so I use getModuleIdentifier(), trying to get the name such as "test.bc." But the result is always <stdin>.
>>
>> Could anyone please help me on this?
>>
>>     
> Is opt reading the input bitcode from standard input (as opposed to
> being given a filename)?  If so, that is probably why the module is
> named stdin.
>
> -- John T.
>   
>> Thank you very much.
>>
>> Jack
>>
>>
>>
>>     
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu>         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> --
> Jack Tzu-Han Hung
> www.cs.princeton.edu/~thhung<http://www.cs.princeton.edu/~thhung>
>
>   




More information about the llvm-dev mailing list