about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-21 19:19:58 -0700
committerbors <bors@rust-lang.org>2013-06-21 19:19:58 -0700
commitdc4560dc26498573516d833cb2333b54071070e3 (patch)
tree1eb6fd5ae7a3a58b350fcc8e22984589d325baf7 /src/libstd
parentf886520d2468507cc80ceb40a26594265052603e (diff)
parente3ef7504e9496f72820af55f8b9838ec0f54d9f0 (diff)
downloadrust-dc4560dc26498573516d833cb2333b54071070e3.tar.gz
rust-dc4560dc26498573516d833cb2333b54071070e3.zip
auto merge of #7182 : Aatch/rust/trans-refactor-pt2, r=graydon
This is another big refactoring of `trans` though this is unlikely to have much of an
impact on code size or speed.

The major change here is the implementation of a `Type` struct which is the new
home for all your LLVM `TypeRef` needs. It's a simple wrapper struct, with static
methods for constructing types, then regular methods for
manipulating/interrogating them. The purpose of this is mostly to make the code
surrounding them somewhat more ideomatic. A line like: `T_ptr(T_ptr(T_i8()))` is 
now `Type::i8().ptr_to().ptr_to()`,which is much more like regular Rust code.

There are a variety of smaller changes here and there:

* Remove address spaces. At least it doesn't generate them, I haven't spent much
  time looking for related code.
* Use a macro for declaring the LLVM intrinsics, makes it look much nicer.
* Make the type for a string slice actually create a named `str_slice` type in LLVM,
  this makes reading the appropriate code much easier.
* Change the way struct and enum type names are generated. This just means
  that a struct like `struct Foo { a: int }` now produces the IR 
  `%struct.Foo = type { i64 }`, which is much easier to read. Similarly, other structs
  are a bit tighter to make it easier to read.

--- --- ---

This PR did get away from me a little, as I occasionally got distracted or as I fixed
up problems with unrelated code that were stopping me from continuing. One major
thing is that this PR contains the work from #7168, since that would have conflicted
with this and it was broken anyway. Sorry for bundling it like this.

Fixes #3670 and #7063

--- --- ---

EDIT: This no longer removes the llvm insn stats.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/unstable/intrinsics.rs112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs
index 13425007785..c38b013a75a 100644
--- a/src/libstd/unstable/intrinsics.rs
+++ b/src/libstd/unstable/intrinsics.rs
@@ -42,22 +42,38 @@ pub extern "rust-intrinsic" {
     /// Atomic compare and exchange, release ordering.
     pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
 
+    #[cfg(not(stage0))]
+    pub fn atomic_cxchg_acqrel(dst: &mut int, old: int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_cxchg_relaxed(dst: &mut int, old: int, src: int) -> int;
+
+
     /// Atomic load, sequentially consistent.
     pub fn atomic_load(src: &int) -> int;
     /// Atomic load, acquire ordering.
     pub fn atomic_load_acq(src: &int) -> int;
 
+    #[cfg(not(stage0))]
+    pub fn atomic_load_relaxed(src: &int) -> int;
+
     /// Atomic store, sequentially consistent.
     pub fn atomic_store(dst: &mut int, val: int);
     /// Atomic store, release ordering.
     pub fn atomic_store_rel(dst: &mut int, val: int);
 
+    #[cfg(not(stage0))]
+    pub fn atomic_store_relaxed(dst: &mut int, val: int);
+
     /// Atomic exchange, sequentially consistent.
     pub fn atomic_xchg(dst: &mut int, src: int) -> int;
     /// Atomic exchange, acquire ordering.
     pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
     /// Atomic exchange, release ordering.
     pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xchg_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xchg_relaxed(dst: &mut int, src: int) -> int;
 
     /// Atomic addition, sequentially consistent.
     pub fn atomic_xadd(dst: &mut int, src: int) -> int;
@@ -65,6 +81,10 @@ pub extern "rust-intrinsic" {
     pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
     /// Atomic addition, release ordering.
     pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xadd_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xadd_relaxed(dst: &mut int, src: int) -> int;
 
     /// Atomic subtraction, sequentially consistent.
     pub fn atomic_xsub(dst: &mut int, src: int) -> int;
@@ -72,6 +92,98 @@ pub extern "rust-intrinsic" {
     pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
     /// Atomic subtraction, release ordering.
     pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xsub_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xsub_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_and(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_and_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_and_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_and_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_and_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_nand(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_nand_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_nand_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_nand_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_nand_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_or(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_or_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_or_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_or_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_or_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_xor(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xor_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xor_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xor_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_xor_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_max(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_max_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_max_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_max_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_max_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_min(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_min_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_min_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_min_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_min_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_umin(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umin_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umin_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umin_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umin_relaxed(dst: &mut int, src: int) -> int;
+
+    #[cfg(not(stage0))]
+    pub fn atomic_umax(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umax_acq(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umax_rel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umax_acqrel(dst: &mut int, src: int) -> int;
+    #[cfg(not(stage0))]
+    pub fn atomic_umax_relaxed(dst: &mut int, src: int) -> int;
 
     /// The size of a type in bytes.
     ///