Need Help

pogde prashant pogde@cse.iitk.ac.in
Fri Dec 3 14:02:00 GMT 1999


Hii
	I was trying to port gcc to 8085.
	but the compiler that is generated crashes on
	some simple programs like
	case 1:
	main()
	{
		register int a;
		register int b;
		b=b+1;
	}

	though it works perfectly for 

	case 2:
	main()
	{
		register int a;
		register int b;
		a=a+1;
	}

	the reason i figured out was :
	in my machine description file
	i have specified patterns for 
	
	(define_insn "addqi3"
  	[(set (match_operand:QI 0 "register_operand" "+a,a")
        	(plus:QI (match_operand:QI 1 "register_operand" "0,0")
                 (match_operand:QI 2 "nonmemory_operand"  "i,r")))]
  		""
  		"@ 
    		ADI %2 
    		ADD %2 "
	)
	where constraint "a" specifies that this operand must be in 
	accumalator(reg no 0).

	and I also have pattern for all register to register move 
	instructions.	
	
	the rtl code that is generated for these two programs
	i m sending with this mail as an attachment.

	the problem is- (in first case )up to local register allocation 
	compiler works perfectly it also generates correct rtl codes.
	but during "reload" phase it crashes.the reason is it assigns
	accumalator(reg 0) to first variable "a" and pseudo register no "2" 
	to second variable before reload pass .
	Now during reload pass it should find out that the values are in 
	wrong registers and add instruction pattern can not be applied on it.
	so it should generate some extra register to 
	register mov instruction so that pattern for "add" instruction 
	in the md file can be applied.but it is crashing in this phase.
	
	i have read just the documentation for how to port gcc to 
	new architectures that comes with gcc package.

	I m not able to find out why the compiler is crashing.
	I would highly appreciate if u can guide me that how to find 
	out and correct error in this case .can u plz also tell me if 
	some other kind of patterns will be required in md file for this 
	particular kind of translation.I think move patterns and pattern 
	for add instruction should be sufficient.I have mapped all data 
	types to 8bits.
thanx and regards
Prashant


More information about the Gcc mailing list