[LLVMdev] Trouble using llvm tools

Reid Spencer reid at x10sys.com
Tue Nov 30 10:57:53 PST 2004


On Tue, 2004-11-30 at 08:58, Chris Lattner wrote:
> On Tue, 30 Nov 2004, Tanu Sharma wrote:
> 
> > I have trouble using the llvm tools.Some of the errors are :
> >
> > $ llvm-dis prog.bc
> > $ llvm-dis: Invalid Top Level Block Length! Type:1, Size:456 (Vers=0, Pos=12)
> 
> Can you explain how you generated this bytecode file?  It looks corrupted
> or something.  Also, can you send the actual bytecode file itself?

Okay, Tanu sent the bytecode file and it works fine with llvm-bcanalyzer
and llvm-dis. The output from those tools are attached. 

So, I think the real question is: "what llvm-dis where you running?".  

Reid.
-------------- next part --------------
target endian = little
target pointersize = 32
	%struct..TorRec = type { int, void ()* }
	%struct.TorRec = type { int, void ()* }
%.str_1 = internal constant [24 x sbyte] c"This is main function \0A\00"		; <[24 x sbyte]*> [#uses=1]
%.str_2 = internal constant [21 x sbyte] c"Calling sub function\00"		; <[21 x sbyte]*> [#uses=1]
%.str_3 = internal constant [21 x sbyte] c"This is sub function\00"		; <[21 x sbyte]*> [#uses=1]
%Initialized.0__ = internal global bool false		; <bool*> [#uses=2]

implementation   ; Functions:

declare int %printf(sbyte*, ...)

declare void %exit(int)

int %main() {
entry:
	%tmp.1.i = load bool* %Initialized.0__		; <bool> [#uses=1]
	br bool %tmp.1.i, label %__main.entry, label %endif.0.i

endif.0.i:		; preds = %entry
	store bool true, bool* %Initialized.0__
	br label %__main.entry

__main.entry:		; preds = %entry, %endif.0.i
	%tmp.0 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([24 x sbyte]* %.str_1, int 0, int 0) )		; <int> [#uses=0]
	%tmp.2 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([21 x sbyte]* %.str_2, int 0, int 0) )		; <int> [#uses=0]
	%tmp.0.i = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([21 x sbyte]* %.str_3, int 0, int 0) )		; <int> [#uses=0]
	call void %exit( int 1 )
	ret int 0
}
-------------- next part --------------

Summary Analysis Of prog.bc: 

   Bytecode Analysis Of Module: prog.bc
       Bytecode Version Number:         3
                     File Size:       469
                  Module Bytes:       469 (100%)
                Function Bytes:       138 (29.42%)
            Global Types Bytes:        42 (8.955%)
           Constant Pool Bytes:       105 (22.39%)
          Module Globals Bytes:        20 (4.264%)
        Instruction List Bytes:        48 (10.23%)
        Compaction Table Bytes:         1 (0.2132%)
            Symbol Table Bytes:       176 (37.53%)
               Alignment Bytes:        29 (6.183%)
            Block Header Bytes:        40 (8.529%)
     Dependent Libraries Bytes:         0 (0%)
     Number Of Bytecode Blocks:        10
           Number Of Functions:         3
               Number Of Types:        15
           Number Of Constants:         8
    Number Of Global Variables:         4
              Number Of Values:        27
        Number Of Basic Blocks:         3
        Number Of Instructions:         9
   Number Of Long Instructions:         3
            Number Of Operands:        16
   Number Of Compaction Tables:         1
       Number Of Symbol Tables:         2
      Number Of Dependent Libs:         0
        Total Instruction Size:        48
      Average Instruction Size:   5.33333
      Maximum Type Slot Number:        14
     Maximum Value Slot Number:        17
              Bytes Per Value :   15.6333
              Bytes Per Global:   6.18519
            Bytes Per Function:        46
      # of VBR 32-bit Integers:       167
      # of VBR 64-bit Integers:         1
     # of VBR Compressed Bytes:       172
       # of VBR Expanded Bytes:       676
          Bytes Saved With VBR:       504 (74.56%)

Detailed Analysis Of prog.bc Functions:

External Function: printf
                         Type::  int (sbyte*, ...)*
                     Byte Size:         1

External Function: exit
                         Type::  void (int)*
                     Byte Size:         1

Function: main
                         Type::  int ()*
                     Byte Size:       136
                  Basic Blocks:         3
                  Instructions:         9
             Long Instructions:         3
                      Operands:         0
              Instruction Size:        48
      Average Instruction Size:   5.33333
         Bytes Per Instruction:   15.1111
      # of VBR 32-bit Integers:        37
      # of VBR 64-bit Integers:         0
     # of VBR Compressed Bytes:        37
       # of VBR Expanded Bytes:       148
          Bytes Saved With VBR:       111
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041130/9879b29d/attachment.sig>


More information about the llvm-dev mailing list