Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- Intrinsics.td - Defines all LLVM intrinsics ---------*- tablegen -*-===// | 1 //===- Intrinsics.td - Defines all LLVM intrinsics ---------*- tablegen -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file defines properties of all LLVM intrinsics. | 10 // This file defines properties of all LLVM intrinsics. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 def int_nacl_tp_tls_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>, | 491 def int_nacl_tp_tls_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>, |
| 492 GCCBuiltin<"__builtin_nacl_tp_tls_offset">; | 492 GCCBuiltin<"__builtin_nacl_tp_tls_offset">; |
| 493 def int_nacl_tp_tdb_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>, | 493 def int_nacl_tp_tdb_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>, |
| 494 GCCBuiltin<"__builtin_nacl_tp_tdb_offset">; | 494 GCCBuiltin<"__builtin_nacl_tp_tdb_offset">; |
| 495 | 495 |
| 496 // The following intrinsic provides a target-specific constant value to | 496 // The following intrinsic provides a target-specific constant value to |
| 497 // indicate the target platform compiled to. The enum values are enumerated | 497 // indicate the target platform compiled to. The enum values are enumerated |
| 498 // pnaclintrin.h. | 498 // pnaclintrin.h. |
| 499 def int_nacl_target_arch : Intrinsic<[llvm_i32_ty], []>, | 499 def int_nacl_target_arch : Intrinsic<[llvm_i32_ty], []>, |
| 500 GCCBuiltin<"__builtin_nacl_target_arch">; | 500 GCCBuiltin<"__builtin_nacl_target_arch">; |
| 501 | |
| 502 // Atomic intrinsics. | |
| 503 // | |
| 504 // Volatiles and atomics are encoded through these intrinsics to make | |
| 505 // them platform-independent, remove some of LLVM's legacy, and isolate | |
| 506 // PNaCl from future changes to IR. The intrinsics allow user code to | |
| 507 // use `__sync_*` builtins as well as C11/C++11 atomics. | |
| 508 // | |
| 509 // The general signature is: | |
| 510 // template<typename T> | |
| 511 // T nacl.atomic.<size>(int32_t operation, T *location, T value, | |
| 512 // T old_value, int32_t memory_order); | |
| 513 // | |
| 514 // Where `T` is a 8, 16, 32 or 64-bit integer (`size` bits), and | |
| 515 // location is naturally aligned to `T`. Valid `operation` and | |
| 516 // `memory_order` values are in llvm/IR/NaCl.h. | |
| 517 // | |
| 518 // Note that not all arguments are meaningful for all operations: | |
|
Mark Seaborn
2013/06/26 14:33:41
I'm not keen on having this be overloaded so that
JF
2013/06/26 15:52:29
We had this discussion last week, before I started
Mark Seaborn
2013/06/26 16:47:01
I was talking about whether we should have a separ
JF
2013/06/26 22:56:36
When I confirm that we agree multiple times, and I
Mark Seaborn
2013/06/27 01:04:33
I slightly preferred fewer variants specifically f
JF
2013/06/27 01:31:39
No, I definitely said one per size, at multiple oc
| |
| 519 // - result = load {atomic|volatile} T* location, align sizeof(T) | |
| 520 // - store {atomic|volatile} T value, T* location memory_order | |
| 521 // - result = atomicrmw OP T* location, T value memory_order | |
| 522 // Where OP is one of: {add, sub, or, and, xor, xchg} | |
| 523 // - result = cmpxchg T* location, T old_value, T value memory_order | |
| 524 // - fence memory_order | |
| 525 def int_nacl_atomic_8 : Intrinsic<[llvm_i8_ty], | |
| 526 [llvm_i32_ty, LLVMPointerType<llvm_i8_ty>, | |
| 527 llvm_i8_ty, llvm_i8_ty, llvm_i32_ty], | |
| 528 [IntrReadWriteArgMem]>; | |
| 529 def int_nacl_atomic_16 : Intrinsic<[llvm_i16_ty], | |
| 530 [llvm_i32_ty, LLVMPointerType<llvm_i16_ty>, | |
| 531 llvm_i16_ty, llvm_i16_ty, llvm_i32_ty], | |
| 532 [IntrReadWriteArgMem]>; | |
| 533 def int_nacl_atomic_32 : Intrinsic<[llvm_i32_ty], | |
|
Mark Seaborn
2013/06/26 14:33:41
You shouldn't need one definition per int size her
JF
2013/06/26 15:52:29
We kind of do: iAny applies to i1 through i128 as
Mark Seaborn
2013/06/26 16:47:01
I don't think the definition in Intrinsics.td need
JF
2013/06/26 22:56:36
That could be done, we'd then have exactly one int
Mark Seaborn
2013/06/27 01:04:33
I'm not sure if we're talking at cross purposes he
JF
2013/06/27 01:31:39
I can implement an overloaded intrinsic, and add t
| |
| 534 [llvm_i32_ty, LLVMPointerType<llvm_i32_ty>, | |
| 535 llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], | |
| 536 [IntrReadWriteArgMem]>; | |
| 537 def int_nacl_atomic_64 : Intrinsic<[llvm_i64_ty], | |
| 538 [llvm_i32_ty, LLVMPointerType<llvm_i64_ty>, | |
| 539 llvm_i64_ty, llvm_i64_ty, llvm_i32_ty], | |
| 540 [IntrReadWriteArgMem]>; | |
| 501 // @LOCALMOD-END | 541 // @LOCALMOD-END |
| 502 | 542 |
| 503 //===----------------------------------------------------------------------===// | 543 //===----------------------------------------------------------------------===// |
| 504 // Target-specific intrinsics | 544 // Target-specific intrinsics |
| 505 //===----------------------------------------------------------------------===// | 545 //===----------------------------------------------------------------------===// |
| 506 | 546 |
| 507 include "llvm/IR/IntrinsicsPowerPC.td" | 547 include "llvm/IR/IntrinsicsPowerPC.td" |
| 508 include "llvm/IR/IntrinsicsX86.td" | 548 include "llvm/IR/IntrinsicsX86.td" |
| 509 include "llvm/IR/IntrinsicsARM.td" | 549 include "llvm/IR/IntrinsicsARM.td" |
| 510 include "llvm/IR/IntrinsicsXCore.td" | 550 include "llvm/IR/IntrinsicsXCore.td" |
| 511 include "llvm/IR/IntrinsicsHexagon.td" | 551 include "llvm/IR/IntrinsicsHexagon.td" |
| 512 include "llvm/IR/IntrinsicsNVVM.td" | 552 include "llvm/IR/IntrinsicsNVVM.td" |
| 513 include "llvm/IR/IntrinsicsMips.td" | 553 include "llvm/IR/IntrinsicsMips.td" |
| 514 include "llvm/IR/IntrinsicsR600.td" | 554 include "llvm/IR/IntrinsicsR600.td" |
| OLD | NEW |