Skip to content

Commit

Permalink
Don't hard-code data layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 30, 2015
1 parent a860592 commit 914261e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
7 changes: 3 additions & 4 deletions src/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,13 @@ fn create_module(module_name: &str) -> Module {
strings: vec![c_module_name],
};

// These are necessary for maximum LLVM performance, see
// This is necessary for maximum LLVM performance, see
// http://llvm.org/docs/Frontend/PerformanceTips.html
let target_triple = get_default_target_triple();
LLVMSetTarget(llvm_module, target_triple.as_ptr());

// can we get this from the module?
LLVMSetDataLayout(llvm_module,
module.new_string_ptr("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"));
// TODO: add a function to the LLVM C API that gives us the
// data layout from the target machine.

add_c_declarations(&mut module);
}
Expand Down
12 changes: 0 additions & 12 deletions src/llvm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn compile_loop() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -86,7 +85,6 @@ fn compile_empty_program() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -122,7 +120,6 @@ fn compile_set() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -171,7 +168,6 @@ fn compile_set_with_offset() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -220,7 +216,6 @@ fn respect_initial_cell_ptr() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -272,7 +267,6 @@ fn compile_multiply_move() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -336,7 +330,6 @@ fn set_initial_cell_values() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -387,7 +380,6 @@ fn compile_static_outputs() {
outputs: vec![5, 10]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
@known_outputs = constant [2 x i8] c\"\\05\\0A\"
Expand Down Expand Up @@ -427,7 +419,6 @@ fn compile_ptr_increment() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -475,7 +466,6 @@ fn compile_increment() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -526,7 +516,6 @@ fn compile_increment_with_offset() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down Expand Up @@ -577,7 +566,6 @@ fn compile_start_instr_midway() {
outputs: vec![]
});
let expected = "; ModuleID = \'foo\'
target datalayout = \"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128\"
target triple = \"i686-pc-linux-gnu\"
; Function Attrs: nounwind
Expand Down

0 comments on commit 914261e

Please sign in to comment.