aboutsummaryrefslogtreecommitdiff
path: root/llvm/bindings
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-07-04 16:26:51 +0200
committerNikita Popov <npopov@redhat.com>2022-07-06 10:11:34 +0200
commit11950efe06822590ff3ee4048df741136c5295bd (patch)
treea81c7cad3dd63bed750d3822e3e043684bd32fed /llvm/bindings
parent02b38ba8aa6ea32be5198849fff93929a117afe6 (diff)
downloadllvm-11950efe06822590ff3ee4048df741136c5295bd.zip
llvm-11950efe06822590ff3ee4048df741136c5295bd.tar.gz
llvm-11950efe06822590ff3ee4048df741136c5295bd.tar.bz2
[ConstExpr] Remove div/rem constant expressions
D128820 stopped creating div/rem constant expressions by default; this patch removes support for them entirely. The getUDiv(), getExactUDiv(), getSDiv(), getExactSDiv(), getURem() and getSRem() on ConstantExpr are removed, and ConstantExpr::get() now only accepts binary operators for which ConstantExpr::isSupportedBinOp() returns true. Uses of these methods may be replaced either by corresponding IRBuilder methods, or ConstantFoldBinaryOpOperands (if a constant result is required). On the C API side, LLVMConstUDiv, LLVMConstExactUDiv, LLVMConstSDiv, LLVMConstExactSDiv, LLVMConstURem and LLVMConstSRem are removed and corresponding LLVMBuild methods should be used. Importantly, this also means that constant expressions can no longer trap! This patch still keeps the canTrap() method to minimize diff -- I plan to drop it in a separate NFC patch. Differential Revision: https://reviews.llvm.org/D129148
Diffstat (limited to 'llvm/bindings')
-rw-r--r--llvm/bindings/go/llvm/ir.go5
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.ml5
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.mli25
3 files changed, 0 insertions, 35 deletions
diff --git a/llvm/bindings/go/llvm/ir.go b/llvm/bindings/go/llvm/ir.go
index 2ac1f15..471da84 100644
--- a/llvm/bindings/go/llvm/ir.go
+++ b/llvm/bindings/go/llvm/ir.go
@@ -918,12 +918,7 @@ func ConstMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstMul(lhs.C, rhs.
func ConstNSWMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstNSWMul(lhs.C, rhs.C); return }
func ConstNUWMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstNUWMul(lhs.C, rhs.C); return }
func ConstFMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstFMul(lhs.C, rhs.C); return }
-func ConstUDiv(lhs, rhs Value) (v Value) { v.C = C.LLVMConstUDiv(lhs.C, rhs.C); return }
-func ConstSDiv(lhs, rhs Value) (v Value) { v.C = C.LLVMConstSDiv(lhs.C, rhs.C); return }
-func ConstExactSDiv(lhs, rhs Value) (v Value) { v.C = C.LLVMConstExactSDiv(lhs.C, rhs.C); return }
func ConstFDiv(lhs, rhs Value) (v Value) { v.C = C.LLVMConstFDiv(lhs.C, rhs.C); return }
-func ConstURem(lhs, rhs Value) (v Value) { v.C = C.LLVMConstURem(lhs.C, rhs.C); return }
-func ConstSRem(lhs, rhs Value) (v Value) { v.C = C.LLVMConstSRem(lhs.C, rhs.C); return }
func ConstFRem(lhs, rhs Value) (v Value) { v.C = C.LLVMConstFRem(lhs.C, rhs.C); return }
func ConstAnd(lhs, rhs Value) (v Value) { v.C = C.LLVMConstAnd(lhs.C, rhs.C); return }
func ConstOr(lhs, rhs Value) (v Value) { v.C = C.LLVMConstOr(lhs.C, rhs.C); return }
diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml
index 3c50e95..19603b9 100644
--- a/llvm/bindings/ocaml/llvm/llvm.ml
+++ b/llvm/bindings/ocaml/llvm/llvm.ml
@@ -651,12 +651,7 @@ external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
external const_nsw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNSWMul"
external const_nuw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNUWMul"
external const_fmul : llvalue -> llvalue -> llvalue = "LLVMConstFMul"
-external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
-external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
-external const_exact_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstExactSDiv"
external const_fdiv : llvalue -> llvalue -> llvalue = "LLVMConstFDiv"
-external const_urem : llvalue -> llvalue -> llvalue = "LLVMConstURem"
-external const_srem : llvalue -> llvalue -> llvalue = "LLVMConstSRem"
external const_frem : llvalue -> llvalue -> llvalue = "LLVMConstFRem"
external const_and : llvalue -> llvalue -> llvalue = "LLVMConstAnd"
external const_or : llvalue -> llvalue -> llvalue = "LLVMConstOr"
diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli
index 584545c..4ce883a 100644
--- a/llvm/bindings/ocaml/llvm/llvm.mli
+++ b/llvm/bindings/ocaml/llvm/llvm.mli
@@ -1139,36 +1139,11 @@ val const_nuw_mul : llvalue -> llvalue -> llvalue
See the method [llvm::ConstantExpr::getFMul]. *)
val const_fmul : llvalue -> llvalue -> llvalue
-(** [const_udiv c1 c2] returns the constant quotient [c1 / c2] of two unsigned
- integer constants.
- See the method [llvm::ConstantExpr::getUDiv]. *)
-val const_udiv : llvalue -> llvalue -> llvalue
-
-(** [const_sdiv c1 c2] returns the constant quotient [c1 / c2] of two signed
- integer constants.
- See the method [llvm::ConstantExpr::getSDiv]. *)
-val const_sdiv : llvalue -> llvalue -> llvalue
-
-(** [const_exact_sdiv c1 c2] returns the constant quotient [c1 / c2] of two
- signed integer constants. The result is undefined if the result is rounded
- or overflows. See the method [llvm::ConstantExpr::getExactSDiv]. *)
-val const_exact_sdiv : llvalue -> llvalue -> llvalue
-
(** [const_fdiv c1 c2] returns the constant quotient [c1 / c2] of two floating
point constants.
See the method [llvm::ConstantExpr::getFDiv]. *)
val const_fdiv : llvalue -> llvalue -> llvalue
-(** [const_urem c1 c2] returns the constant remainder [c1 MOD c2] of two
- unsigned integer constants.
- See the method [llvm::ConstantExpr::getURem]. *)
-val const_urem : llvalue -> llvalue -> llvalue
-
-(** [const_srem c1 c2] returns the constant remainder [c1 MOD c2] of two
- signed integer constants.
- See the method [llvm::ConstantExpr::getSRem]. *)
-val const_srem : llvalue -> llvalue -> llvalue
-
(** [const_frem c1 c2] returns the constant remainder [c1 MOD c2] of two
signed floating point constants.
See the method [llvm::ConstantExpr::getFRem]. *)