[PATCH] D25261: [C API] Add LLVMConstBinOp function.

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 17:13:21 PDT 2016


mjacob created this revision.
mjacob added a subscriber: llvm-commits.
Herald added a reviewer: deadalnix.

This is analog to the existing LLVMBuildBinOp function.


https://reviews.llvm.org/D25261

Files:
  include/llvm-c/Core.h
  lib/IR/Core.cpp


Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ lib/IR/Core.cpp
@@ -1230,6 +1230,13 @@
                                    unwrap<Constant>(RHSConstant)));
 }
 
+LLVMValueRef LLVMConstBinOp(LLVMOpcode Op, LLVMValueRef LHSConstant,
+                            LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::get(map_from_llvmopcode(Op),
+                                unwrap<Constant>(LHSConstant),
+                                unwrap<Constant>(RHSConstant)));
+}
+
 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
                            LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
   return wrap(ConstantExpr::getICmp(Predicate,
Index: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -1762,6 +1762,8 @@
 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstBinOp(LLVMOpcode Op, LLVMValueRef LHSConstant,
+                            LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
                            LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25261.73584.patch
Type: text/x-patch
Size: 1464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161005/a2ab3e46/attachment.bin>


More information about the llvm-commits mailing list