Add an unwind_to field to basic blocks, making them Users instead of Values.
[oota-llvm.git] / include / llvm / Intrinsics.td
index 4b1e419d6517c411ba92f1ceb8c5f97146d12661..c29bd407fdcd542789390065e4fb4fbc4aea97e1 100644 (file)
@@ -2,8 +2,8 @@
 // 
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Chris Lattner and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 // 
 //===----------------------------------------------------------------------===//
 //
@@ -64,7 +64,7 @@ class LLVMPointerType<LLVMType elty>
 class LLVMMatchType<int num>
   : LLVMType<OtherVT>{
   int Number = num;
-} 
+}
 
 def llvm_void_ty       : LLVMType<isVoid>;
 def llvm_anyint_ty     : LLVMType<iAny>;
@@ -149,12 +149,19 @@ def int_gcwrite : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
 //  
 def int_returnaddress : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>;
 def int_frameaddress  : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>;
-def int_stacksave     : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>,
+
+// Note: we treat stacksave/stackrestore as writemem because we don't otherwise
+// model their dependencies on allocas.
+def int_stacksave     : Intrinsic<[llvm_ptr_ty]>,
                         GCCBuiltin<"__builtin_stack_save">;
 def int_stackrestore  : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>,
                         GCCBuiltin<"__builtin_stack_restore">;
+// IntrWriteArgMem is more pessimistic than strictly necessary for prefetch,
+// however it does conveniently prevent the prefetch from being reordered
+// with respect to nearby accesses to the same memory.
 def int_prefetch      : Intrinsic<[llvm_void_ty, llvm_ptr_ty, 
-                                   llvm_i32_ty, llvm_i32_ty]>;
+                                   llvm_i32_ty, llvm_i32_ty],
+                                  [IntrWriteArgMem]>;
 def int_pcmarker      : Intrinsic<[llvm_void_ty, llvm_i32_ty]>;
 
 def int_readcyclecounter : Intrinsic<[llvm_i64_ty]>;
@@ -178,18 +185,12 @@ let Properties = [IntrWriteArgMem] in {
 }
 
 let Properties = [IntrNoMem] in {
-  def int_sqrt_f32 : Intrinsic<[llvm_float_ty, llvm_float_ty]>;
-  def int_sqrt_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty]>;
-  def int_sqrt_f80 : Intrinsic<[llvm_f80_ty, llvm_f80_ty]>;
-  def int_sqrt_f128 : Intrinsic<[llvm_f128_ty, llvm_f128_ty]>;
-  def int_sqrt_ppcf128 : Intrinsic<[llvm_ppcf128_ty, llvm_ppcf128_ty]>;
-
-  def int_powi_f32 : Intrinsic<[llvm_float_ty, llvm_float_ty, llvm_i32_ty]>;
-  def int_powi_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty, llvm_i32_ty]>;
-  def int_powi_f80 : Intrinsic<[llvm_f80_ty, llvm_f80_ty, llvm_i32_ty]>;
-  def int_powi_f128 : Intrinsic<[llvm_f128_ty, llvm_f128_ty, llvm_i32_ty]>;
-  def int_powi_ppcf128 : Intrinsic<[llvm_ppcf128_ty, llvm_ppcf128_ty, 
-                                    llvm_i32_ty]>;
+  def int_sqrt : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>]>;
+  def int_powi : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>, llvm_i32_ty]>;
+  def int_sin  : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>]>;
+  def int_cos  : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>]>; 
+  def int_pow  : Intrinsic<[llvm_anyfloat_ty,
+                            LLVMMatchType<0>, LLVMMatchType<0>]>; 
 }
 
 // NOTE: these are internal interfaces.
@@ -261,9 +262,34 @@ def int_init_trampoline : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty,
                                      llvm_ptr_ty], []>,
                           GCCBuiltin<"__builtin_init_trampoline">;
 
+//===------------------------- Atomic Intrinsics --------------------------===//
+//
+def int_memory_barrier : Intrinsic<[llvm_void_ty, llvm_i1_ty, llvm_i1_ty, 
+                                       llvm_i1_ty, llvm_i1_ty, llvm_i1_ty], []>;
+
+def int_atomic_lcs : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+                                 LLVMMatchType<0>, LLVMMatchType<0>],
+                               [IntrWriteArgMem]>, GCCBuiltin<"__sync_val_compare_and_swap">;
+def int_atomic_las : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+                                 LLVMMatchType<0>],
+                               [IntrWriteArgMem]>, GCCBuiltin<"__sync_fetch_and_add">;
+def int_atomic_swap : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+                                 LLVMMatchType<0>],
+                               [IntrWriteArgMem]>, GCCBuiltin<"__sync_lock_test_and_set">;
+
+
+//===-------------------------- Other Intrinsics --------------------------===//
+//
+def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
+                     GCCBuiltin<"__builtin_flt_rounds">;
+def int_trap : Intrinsic<[llvm_void_ty]>,
+               GCCBuiltin<"__builtin_trap">;
+
 //===----------------------------------------------------------------------===//
 // Target-specific intrinsics
 //===----------------------------------------------------------------------===//
 
 include "llvm/IntrinsicsPowerPC.td"
 include "llvm/IntrinsicsX86.td"
+include "llvm/IntrinsicsARM.td"
+include "llvm/IntrinsicsCellSPU.td"