Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updates

  • Loading branch information...
commit f3e9222d347de67d49f3ce3d8dbf73ac6e1379c7 1 parent 5bfaa26
@duncantl authored
View
5 Changelog
@@ -1,7 +1,10 @@
Version 0.4-1
* Compiles and installs with LLVM 3.1.
-
+
+ * parseIR() function allows us to parse IR code and so we
+ could create the code via strings.
+
Version 0.4-0
* Added getDescription() and method for Type and getTypeID(),
View
11 FAQ.xml
@@ -1,12 +1,3 @@
<faq>
-<q>
-I get errors of the form
-<quote>
- failed to create execution engine: Unable to find target for this triple (no targets are registered)
-</quote>
-What's the problem?
-<a>
-You need to call InitializeNativeTarget() before creating the execution engine.
-</a>
-</q>
+
</faq>
View
3  NAMESPACE
@@ -215,3 +215,6 @@ exportMethods(getDescription)
export(isVoidType, isFloatType, isDoubleType, isX86_FP80Type, isFP128Type,
isPPC_FP128Type, isLabelType, isMetadataType, isIntegerType, isFunctionType,
isStructType, isArrayType, isPointerType, isOpaqueType, isVectorType)
+
+
+export(parseIR)
View
12 R/IRBuilder.R
@@ -313,3 +313,15 @@ function(ir)
{
.Call("R_IRBuilder_getTrue", ir)
}
+
+
+parseIR =
+function(content, context = NULL, asText = is(content, "AsIs") || !file.exists(content))
+{
+ if(!asText)
+ content = path.expand(content)
+ else
+ content = paste(as.character(content), collapse = "\n")
+
+ .Call("R_llvm_ParseIRFile", content, as.logical(asText), context)
+}
View
9 Todo.xml
@@ -3,6 +3,15 @@
<items>
<item>
+Find out how to parse IR text into IR structures.
+<br/>
+ParseIRFile() in opt.cpp.
+So Support/IRReader.h
+<br/>
+For BitCode, see include/llvm/Bitcode/ReaderWriter.h
+</item>
+
+<item>
In the TU, ExecutionEngine create method has an NA for the type of one of the parameters.
The type is there and the name of the type is also there, just not shown.
<r:code>
View
2  Web/GNUmakefile
@@ -1,5 +1,5 @@
PKG=Rllvm
-WEB_DIR=www.omegahat.org:/home3/WebSites/Omega/$(PKG)
+WEB_DIR=www.omegahat.org:~/OmegaWeb/$(PKG)
shipIndex: index.html extra
View
6 Web/index.html.in
@@ -6,8 +6,10 @@
<body>
<h1>The Rllvm Package</h1>
+<p align=right><a href="https://github.com/duncantl/Rllvm">Rllvm on github</a></p>
<p align=right><a href="@TAR_FILE@">@TAR_FILE@</a> (@DATE@)</p>
-<p align=right><a href="philosophy.html">Manual</a></p>
+<p align=left><img src="../new.jpg"/><a href="JSM2012/frames.html">JSM2012 Talk</a></p>
+<!--<p align=right><a href="philosophy.html">Manual</a></p> -->
The Rllvm package is an R-interface to the <a
href="http://llvm.org">llvm</a> library that provides
@@ -145,7 +147,7 @@ This is distributed under the GPL2 License.
<address><a href="http://www.stat.ucdavis.edu/~duncan">Duncan Temple Lang</a>
<a href=mailto:duncan@wald.ucdavis.edu>&lt;duncan@wald.ucdavis.edu&gt;</a></address>
<!-- hhmts start -->
-Last modified: Wed Sep 8 09:57:12 PDT 2010
+Last modified: Sun Aug 5 20:34:49 PDT 2012
<!-- hhmts end -->
</body> </html>
View
32 src/IRBuilder.cpp
@@ -593,3 +593,35 @@ R_IRBuilder_getCurrentFunctionReturnType(SEXP r_builder)
}
+
+
+#include <llvm/Support/IRReader.h>
+extern "C"
+SEXP
+R_llvm_ParseIRFile(SEXP r_content, SEXP r_inMemory, SEXP r_context)
+{
+ llvm::Module *mod;
+ llvm::SMDiagnostic err;
+
+ llvm::LLVMContext *context;
+ if(Rf_length(r_context))
+ context = (GET_REF(r_context, LLVMContext)); // llvm::cast<llvm::LLVMContext>
+ else
+ context = & llvm::getGlobalContext();
+
+ std::string fn(CHAR(STRING_ELT(r_content, 0)));
+
+ if(LOGICAL(r_inMemory)[0]) {
+ llvm::MemoryBuffer *buf;
+ buf = llvm::MemoryBuffer::getMemBuffer(fn);
+ mod = llvm::ParseIR(buf, err, *context);
+ } else {
+ mod = llvm::ParseIRFile(fn, err, *context);
+ }
+ if(!mod) {
+ PROBLEM "failed to parse IR: (line = %d, col = %d), %s",
+ err.getLineNo(), err.getColumnNo(), err.getMessage().c_str()
+ ERROR;
+ }
+ return(mod ? R_createRef(mod, "Module") : R_NilValue );
+}
View
18 tests/cumsum.Rdb
@@ -416,6 +416,24 @@ Now we compare the byte-compiled code and the LLVM-compiled code:
</r:code>
</para>
+<para>
+Curiously, on eeyore - an Ubuntu Linux machine -
+we get much worse performance comparing
+interpreted to LLVM-compiled code.
+The interpreted code is running about 30 faster on
+the Linux box.
+The LLVM-code is running about as 10th as fast as it does on OS X.
+<r:code>
+print((rowMeans(interp)/rowMeans(ll))[1:3], digits = 3)
+<r:output><![CDATA[
+user.self sys.self elapsed
+ 23.8803 0.0435 20.5082
+]]></r:output>
+</r:code>
+This may be due to
+</para>
+
+
</section>
</article>
View
10 tests/rw2d.Rdb
@@ -368,6 +368,8 @@ With an optimized R (i.e. compiled with -O3)
<invisible>
+All of these done with the same version of Rllvm &amp; LLVM
+ 3.1 and
R-2.16 on my Mac laptop Aug 4, 2012
Time Speedup
@@ -389,6 +391,14 @@ Interpeted 255.310 1.000000
Byte Compiled 167.970 1.519974
Vectorized 1.365 187.040293
Rllvm 0.970 263.206186
+
+
+eeyore:
+ Time Speedup
+Interpeted 171.62 1.000000
+Byte Compiled 85.49 2.007486
+Vectorized 0.88 195.022727
+Rllvm 0.70 245.171429
</invisible>
Please sign in to comment.
Something went wrong with that request. Please try again.