Permalink
Browse files

integer trunc and added extra files to DESCRIPTION's collate

  • Loading branch information...
1 parent 5fd8df6 commit 06ba482064692996d01a257acc1f7a863ab05865 @duncantl committed Jul 16, 2013
Showing with 28 additions and 3 deletions.
  1. +1 −1 Changelog
  2. +1 −0 DESCRIPTION
  3. +1 −1 NAMESPACE
  4. +8 −1 R/IRBuilder.R
  5. +17 −0 src/IRBuilder.cpp
View
@@ -5,7 +5,7 @@ Version 0.6-0
* added support specifying address space when creating pointer types
- * added CreateFPTrunc()
+ * added CreateFPTrunc() and CreateTrunc()
* added llvmDump() to examine instructions in IR form
View
@@ -35,3 +35,4 @@ Collate: llvmVersion.R classDefs.R manual_generics.R BinaryOpEnums.R Function.R
opCodeClassMap.R
classof.R initialize.R
CallingConvEnum.R
+ llvmPTXUtils.R
View
@@ -398,4 +398,4 @@ export(getDefaultTargetTriple)
S3method(flush, formatted_raw_ostream)
-export(createFPTrunc)
+export(createFPTrunc, createTrunc)
View
@@ -463,4 +463,11 @@ createFPTrunc =
function(builder, value, type, id = "")
{
.Call("R_IRBuilder_CreateFPTrunc", as(builder, "IRBuilder"), as(value, "Value"), as(type, "Type"), as.character(id))
-}
+}
+
+createTrunc =
+function(builder, value, type, id = "")
+{
+ .Call("R_IRBuilder_CreateTrunc", as(builder, "IRBuilder"), as(value, "Value"), as(type, "Type"), as.character(id))
+}
+
View
@@ -870,3 +870,20 @@ R_IRBuilder_CreateFPTrunc(SEXP r_builder, SEXP r_value, SEXP r_type, SEXP r_id)
}
+extern "C"
+SEXP
+R_IRBuilder_CreateTrunc(SEXP r_builder, SEXP r_value, SEXP r_type, SEXP r_id)
+{
+ llvm::IRBuilder<> *builder;
+ builder = GET_REF(r_builder, IRBuilder<>);
+ llvm::Value *value = GET_REF(r_value, Value);
+ llvm::Type *type = GET_REF(r_type, Type);
+
+ llvm::Value *ans = builder->CreateTrunc(value, type);
+ if(Rf_length(r_id))
+ ans->setName(makeTwine(r_id));
+
+ return(R_createRef(ans, "TruncInst"));
+}
+
+

0 comments on commit 06ba482

Please sign in to comment.