@@ -84,11 +84,18 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
84
84
85
85
let mut constraints = str::connect(constraints, " , ");
86
86
87
+ let mut clobbers = getClobbers();
88
+ if *ia.clobbers != ~" " && clobbers != ~" " {
89
+ clobbers = *ia.clobbers + ~" , " + clobbers;
90
+ } else {
91
+ clobbers += *ia.clobbers;
92
+ };
93
+
87
94
// Add the clobbers to our constraints list
88
- if *ia. clobbers != ~" " && constraints != ~" " {
89
- constraints += ~" , " + *ia. clobbers;
95
+ if clobbers != ~" " && constraints != ~" " {
96
+ constraints += ~" , " + clobbers;
90
97
} else {
91
- constraints += *ia. clobbers;
98
+ constraints += clobbers;
92
99
}
93
100
94
101
debug!(" Asm Constraints : %?", constraints);
@@ -131,3 +138,18 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
131
138
return bcx;
132
139
133
140
}
141
+
142
+ // Default per-arch clobbers
143
+ // Basically what clang does
144
+
145
+ #[cfg(target_arch = " arm")]
146
+ #[cfg(target_arch = " mips")]
147
+ fn getClobbers() -> ~str {
148
+ ~" "
149
+ }
150
+
151
+ #[cfg(target_arch = " x86")]
152
+ #[cfg(target_arch = " x86_64")]
153
+ fn getClobbers() -> ~str {
154
+ ~" ~{ dirflag} , ~{ fpsr} , ~{ flags} "
155
+ }
0 commit comments