]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_llvm/value.rs
Generalized base.rs#call_memcpy and everything that it uses
[rust.git] / src / librustc_codegen_llvm / value.rs
index 357cc8fbf80e8439f7b58b9b84761be42c303148..1b789f67b57b9c0c0cfd8d70d03699293d0459d7 100644 (file)
 use std::fmt;
 use std::hash::{Hash, Hasher};
 
-pub trait ValueTrait: fmt::Debug {}
+pub trait ValueTrait: fmt::Debug {
+    fn to_llvm(&self) -> &llvm::Value;
+    fn of_llvm(&llvm::Value) -> &Self;
+}
 
 impl PartialEq for Value {
     fn eq(&self, other: &Self) -> bool {
@@ -23,7 +26,14 @@ fn eq(&self, other: &Self) -> bool {
     }
 }
 
-impl ValueTrait for Value {}
+impl ValueTrait for Value {
+    fn to_llvm(&self) -> &llvm::Value {
+        &self
+    }
+    fn of_llvm(v: &llvm::Value) -> &Self {
+        &v
+    }
+}
 
 impl Eq for Value {}