提交 cf6c3d96 编写于 作者: P Patrick Walton

librustc: Attempt to put out burning tree by fixing translation of unary...

librustc: Attempt to put out burning tree by fixing translation of unary negation in boolean constants. rs=burningtree
上级 b34f871d
......@@ -445,14 +445,19 @@ pub unsafe fn LLVMConstStructInContext(C: ContextRef,
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 unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
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 unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
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) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册