<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 6/16/14, 2:41 PM, Prashanth Sharma
wrote:<br>
</div>
<blockquote
cite="mid:CAJ+w9q7A3ona4vusvMa9yD6FDYXQXHSxd=cYCNVJqWoEHRcwPw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">
<div>Sir,<br>
</div>
I have attached the full procedure I have followed.may be this
would help you to understand my problem<br>
</div>
</blockquote>
<br>
The problem is that you're not specifying all the -I options needed
to tell clang where to find the LLVM header files that Hello.cpp is
using.<br>
<br>
Here's what you should do:<br>
<br>
1) Go to the place where Hello.cpp is and do a make clean<br>
2) Rebuild Hello.so, but use make VERBOSE=1 to get make to print out
the commands it is running to build Hello.o and Hello.so<br>
3) Take those commands and replace gcc with clang and add the
-emit-llvm option.<br>
<br>
For example, in an old LLVM 3.2 sample project, make VERBOSE=1
generates the following output:<br>
<br>
clang -I/Users/criswell/box/x86/llvm32/include
-I/Users/criswell/box/x86/llvm32/projects/sample/include
-I/Users/criswell/box/x86/llvm32/projects/sample/lib/sample
-I/Users/criswell/src/llvm32/include
-I/Users/criswell/src/llvm32/projects/sample/include
-I/Users/criswell/src/llvm32/projects/sample/lib/sample -D_DEBUG
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -O3 -fno-common -m64 -pedantic
-Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c
-MMD -MP -MF
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.d.tmp"
-MT
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.o"
-MT
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.d"
/Users/criswell/src/llvm32/projects/sample/lib/sample/sample.c -o
/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.o<br>
<br>
Since make is already using clang to compile the code, I don't need
to change that. However, I need to add -emit-llvm to make sample.o
a bitcode file:<br>
<br>
clang -emit-llvm -I/Users/criswell/box/x86/llvm32/include
-I/Users/criswell/box/x86/llvm32/projects/sample/include
-I/Users/criswell/box/x86/llvm32/projects/sample/lib/sample
-I/Users/criswell/src/llvm32/include
-I/Users/criswell/src/llvm32/projects/sample/include
-I/Users/criswell/src/llvm32/projects/sample/lib/sample -D_DEBUG
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -O3 -fno-common -m64 -pedantic
-Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c
-MMD -MP -MF
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.d.tmp"
-MT
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.o"
-MT
"/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.d"
/Users/criswell/src/llvm32/projects/sample/lib/sample/sample.c -o
/Users/criswell/box/x86/llvm32/projects/sample/lib/sample/Release+Asserts/sample.o<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote
cite="mid:CAJ+w9q7A3ona4vusvMa9yD6FDYXQXHSxd=cYCNVJqWoEHRcwPw@mail.gmail.com"
type="cite">
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Jun 16, 2014 at 12:17 AM, John
Criswell <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="">
<div>On 6/15/14, 12:04 PM, Prashanth Sharma wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Let's take Hello.cpp pass file from
llvm/lib/Transform/Hello. Now I want to run <span
style="font-family:arial,sans-serif;font-size:13px">clang
-emit-llvm -c Hello.cpp(Hello.c).Means I want to
apply this pass on itself.Then there are too many
errors.</span></div>
</blockquote>
<br>
</div>
You need to be more specific about how you are running
your pass on the bitcode file and what errors you are
seeing. No one can figure out what the problem is with
the small amount of information that you have provided.<br>
<br>
Regards,<br>
<br>
John Criswell
<div class=""><br>
<br>
<blockquote type="cite">
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Sun, Jun 15, 2014 at
10:27 PM, John Criswell <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:criswell@illinois.edu"
target="_blank">criswell@illinois.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>
<div>On 6/14/14, 6:02 AM, Prashanth Sharma
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi,
<div>I applied some pass i.e. Hello
pass on Hello.cpp(the pass file).It
doesnot work as using command clang
-emit-llvm -c Hello.c(Hell.cpp) does
not create any .bc file .Can any body
have some suggestion ?<br clear="all">
</div>
</div>
</blockquote>
<br>
</div>
Is the problem that you can't create a bitcode
file or that you can't get clang to run your
pass?<br>
<br>
Assuming you can't generate a bitcode file,
clang -emit-llvm -c <file.c> should
create a file ending with .o that is an LLVM
bitcode file. It will not have a .bc suffix.<br>
<br>
Regards,<br>
<br>
John Criswell<span><font color="#888888"><br>
<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
-- <br>
<div dir="ltr">
<div><font
face="arial,helvetica,sans-serif">Thanks <br>
</font></div>
<font
face="arial,helvetica,sans-serif">Prashant
Sharma<br>
</font></div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
LLVM Developers mailing list
<a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div><font face="arial,helvetica,sans-serif">Thanks
<br>
</font></div>
<font face="arial,helvetica,sans-serif">Prashant
Sharma<br>
</font></div>
</div>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div dir="ltr">
<div><font face="arial,helvetica,sans-serif">Thanks <br>
</font></div>
<font face="arial,helvetica,sans-serif">Prashant Sharma<br>
</font></div>
</div>
</blockquote>
<br>
</body>
</html>