[LLVMdev] A quick update on FreeBSD support

Marcel Moolenaar xcllnt at mac.com
Wed May 28 12:00:14 PDT 2008


On May 27, 2008, at 9:28 PM, Chris Lattner wrote:

>>>> My current plan is as follows:
>>>> o  Resolve powerpc failures to bring it in line with amd64 & i386.

BTW: PowerPC is now inline with amd64 and powerpc. See also:
	http://wiki.freebsd.org/LowLevelVirtualMachine

>>>> No, not entirely. I added some debug printf's and I see them
>> pop up in the output, but there are more failures:

[skipping valuable feedback and suggestions...]

> I get:
> Couldn't allocate output reg for contraint 'r'!

I'm running with local mods. I implemented the 'r' constraint
already. Sorry, I didn't make that clear...

>> FAIL: /dumpster/home/marcel/LLVM/src/llvm/test/ExecutionEngine/
>> 2003-08-21-EnvironmentTest.ll
>> Failed with signal(SIGABRT) at line 2
>> while running: lli 2003-08-21-EnvironmentTest.ll.tmp.bc > /dev/null
>> Assertion failed: (BitWidth == RHS.BitWidth && "Comparison requires
>> equal bit widths"), function operator==, file /dumpster/home/marcel/
>> LLVM/src/llvm/lib/Support/APInt.cpp, line 518.
>
> I can't repro this one.  Is it trying to run the jit or is this an
> abort in the interpreter?

It's an abort in the interpreter. Consider the input:

\begin{input}
	declare i32 @strlen(i8*)

	define i32 @main(i32 %argc.1, i8** %argv.1, i8** %envp.1) {
	        %tmp.2 = load i8** %envp.1              ; <i8*> [#uses=1]
	        %tmp.3 = call i32 @strlen( i8* %tmp.2 )         ; <i32>  
[#uses=1]
	        %T = icmp eq i32 %tmp.3, 0              ; <i1> [#uses=1]
	        %R = zext i1 %T to i32          ; <i32> [#uses=1]
	        ret i32 %R
	}
\end{input}

The compare gets a 64-bit integer (the result of strlen()) and a 32-bit
integer (the constant 0). This may be a problem with the input, because
the call to strlen() is declared as returning an i32, but a size_t on
ia64 is 64-bits. However, this would assume that the interpreter knows
about it, so it may not be that simple :-)

pluto2% gdb ../../Debug/bin/lli
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
you are
welcome to change it and/or distribute copies of it under certain  
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for  
details.
This GDB was configured as "ia64-marcel-freebsd"...
(gdb) set args < EnvironmentTest.bc
(gdb) br __assert
Function "__assert" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (__assert) pending.
(gdb) run
Starting program: /dumpster/home/marcel/LLVM/obj/ia64/Debug/bin/lli <  
EnvironmentTest.bc
Breakpoint 2 at 0x200000004163c3b0
Pending breakpoint "__assert" resolved

Breakpoint 2, 0x200000004163c3b0 in __assert () from /lib/libc.so.7
Current language:  auto; currently c
(gdb) bt
#0  0x200000004163c3b0 in __assert () from /lib/libc.so.7
#1  0x2000000000e3c490 in llvm::APInt::operator==  
(this=0x9fffffffffffe7a0, RHS=@0x9fffffffffffe788) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/Support/APInt.cpp:518
#2  0x20000000003cb9f0 in llvm::APInt::eq (this=0x9fffffffffffe7a0,  
RHS=@0x9fffffffffffe788) at APInt.h:719
#3  0x20000000003931e0 in executeICMP_EQ (Src1=@0x9fffffffffffe798,  
Src2=@0x9fffffffffffe780, Ty=0x200000000120a300) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:152
#4  0x20000000003a1c60 in llvm::Interpreter::visitICmpInst  
(this=0x2000000001240200, I=@0x200000000122c130) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:286
#5  0x20000000003cd020 in llvm::InstVisitor<llvm::Interpreter,  
void>::visitICmp (this=0x2000000001240200, I=@0x200000000122c130) at  
Instruction.def:156
#6  0x20000000003cdf00 in llvm::InstVisitor<llvm::Interpreter,  
void>::visit (this=0x2000000001240200, I=@0x200000000122c130) at  
Instruction.def:156
#7  0x20000000003a35c0 in llvm::Interpreter::run  
(this=0x2000000001240200) at /dumpster/home/marcel/LLVM/src/llvm/lib/ 
ExecutionEngine/Interpreter/Execution.cpp:1338
#8  0x20000000003b01a0 in llvm::Interpreter::runFunction  
(this=0x2000000001240200, F=0x2000000001232230,  
ArgValues=@0x9fffffffffffe978) at /dumpster/home/marcel/LLVM/src/llvm/ 
lib/ExecutionEngine/Interpreter/Interpreter.cpp:99
#9  0x20000000003e4a80 in llvm::ExecutionEngine::runFunctionAsMain  
(this=0x2000000001240200, Fn=0x2000000001232230,  
argv=@0x2000000001132f08, envp=0x9fffffffffffeb08) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/ExecutionEngine/ExecutionEngine.cpp:338
#10 0x2000000000309930 in main (argc=1, argv=0x9fffffffffffeaf8,  
envp=0x9fffffffffffeb08) at /dumpster/home/marcel/LLVM/src/llvm/tools/ 
lli/lli.cpp:163
(gdb) up
#1  0x2000000000e3c490 in llvm::APInt::operator==  
(this=0x9fffffffffffe7a0, RHS=@0x9fffffffffffe788) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/Support/APInt.cpp:518
518	  assert(BitWidth == RHS.BitWidth && "Comparison requires equal  
bit widths");
Current language:  auto; currently c++
(gdb) p BitWidth
$1 = 64
(gdb) p RHS.BitWidth
$2 = 32
(gdb) frame 3
#3  0x20000000003931e0 in executeICMP_EQ (Src1=@0x9fffffffffffe798,  
Src2=@0x9fffffffffffe780, Ty=0x200000000120a300) at /dumpster/home/ 
marcel/LLVM/src/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:152
152	    IMPLEMENT_INTEGER_ICMP(eq,Ty);
(gdb) p Src1
$3 = (class llvm::GenericValue &) @0x9fffffffffffe798: {{DoubleVal =  
0, FloatVal = 0, PointerVal = 0x0, UIntPairVal = {first = 0, second =  
0}, Untyped = "\000\000\000\000\000\000\000"}, IntVal = {BitWidth =  
64, {VAL = 10, pVal = 0xa}}}
(gdb) p Src2
$4 = (class llvm::GenericValue &) @0x9fffffffffffe780: {{DoubleVal =  
0, FloatVal = 0, PointerVal = 0x0, UIntPairVal = {first = 0, second =  
0}, Untyped = "\000\000\000\000\000\000\000"}, IntVal = {BitWidth =  
32, {VAL = 0, pVal = 0x0}}}
(gdb)

I decided not to worry about it. Let me know if you like to know
where the 64-bit value (i.e. Src1) comes from...

-- 
Marcel Moolenaar
xcllnt at mac.com






More information about the llvm-dev mailing list