librustc: Attempt to put out burning tree by fixing translation of unary negation in boolean constants. rs=burningtree
This commit is contained in:
parent
b34f871dda
commit
cf6c3d96fb
@ -445,14 +445,19 @@ pub extern mod llvm {
|
||||
Count: c_uint,
|
||||
Packed: Bool) -> ValueRef;
|
||||
|
||||
pub unsafe fn LLVMConstString(Str: *c_char, Length: c_uint,
|
||||
DontNullTerminate: Bool) -> ValueRef;
|
||||
pub unsafe fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
|
||||
Length: c_uint) -> ValueRef;
|
||||
pub unsafe fn LLVMConstString(Str: *c_char,
|
||||
Length: c_uint,
|
||||
DontNullTerminate: Bool)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstArray(ElementTy: TypeRef,
|
||||
ConstantVals: *ValueRef,
|
||||
Length: c_uint)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
|
||||
Count: c_uint, Packed: Bool) -> ValueRef;
|
||||
Count: c_uint,
|
||||
Packed: Bool) -> ValueRef;
|
||||
pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
|
||||
Size: c_uint) -> ValueRef;
|
||||
Size: c_uint) -> ValueRef;
|
||||
|
||||
/* Constant expressions */
|
||||
pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
|
||||
@ -463,8 +468,8 @@ pub extern mod llvm {
|
||||
pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
|
||||
pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
|
||||
pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
@ -475,14 +480,14 @@ pub extern mod llvm {
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstSub(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef,
|
||||
RHSConstant: ValueRef)
|
||||
-> ValueRef;
|
||||
|
@ -204,7 +204,18 @@ pub fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
|
||||
ast::box(_) |
|
||||
ast::uniq(_) |
|
||||
ast::deref => const_deref(cx, te),
|
||||
ast::not => llvm::LLVMConstNot(te),
|
||||
ast::not => {
|
||||
match ty::get(ty).sty {
|
||||
ty::ty_bool => {
|
||||
// Somewhat questionable, but I believe this is
|
||||
// correct.
|
||||
let te = llvm::LLVMConstTrunc(te, T_i1());
|
||||
let te = llvm::LLVMConstNot(te);
|
||||
llvm::LLVMConstZExt(te, T_bool())
|
||||
}
|
||||
_ => llvm::LLVMConstNot(te),
|
||||
}
|
||||
}
|
||||
ast::neg => {
|
||||
if is_float { llvm::LLVMConstFNeg(te) }
|
||||
else { llvm::LLVMConstNeg(te) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user