#!/usr/bin/perl
# Wrapper around LLVM tools to generate a native .o from llvm-gcc using an
# LLVM back-end (CBE by default).

# set up defaults.
$Verbose = 0;
$SaveTemps = 0;
$PreprocessOnly = 0;
$CompileDontLink = 0;
$Backend = 'cbe';
chomp ($ProgramName = `basename $0`);

sub boldprint {
	print "[1m", @_, "[0m";
}

# process command-line options.
# most of these are passed on to llvm-gcc.
$GCCOptions = "";
for ($i = 0; $i <= $#ARGV; ++$i) {	
	if ($ARGV[$i] =~ /-mllvm-backend=([a-z0-9]*)/) {
		$Backend = $1;
		if ($ProgramName =~ /llvm-native-gcc/) {
			splice (@ARGV, $i, 1);
			--$i;
		}
	} elsif ($ARGV[$i] eq "-E") {
		$PreprocessOnly = 1;
	} elsif ($ARGV[$i] eq "-c") {
		$GCCOptions .= " " . $ARGV[$i];
		$CompileDontLink = 1;
	} elsif ($ARGV[$i] eq "-v") {
		$GCCOptions .= " " . $ARGV[$i];
		$Verbose = 1;
	} elsif ($ARGV[$i] eq "-o") {
		$OutputFile = $ARGV[$i + 1];
	} elsif ($ARGV[$i] eq "-save-temps") {
		$GCCOptions .= " " . $ARGV[$i];
		$SaveTemps = 1;
	} elsif ($ARGV[$i] =~ /\.bc$/) {
		push (@BytecodeFiles, $ARGV[$i]);
	} elsif ($ARGV[$i] =~ /^-L/) {
		$GCCOptions .= " " . $ARGV[$i];
		push (@LibDirs, $ARGV[$i]);
	} elsif ($ARGV[$i] =~ /^-l/) {
		$GCCOptions .= " " . $ARGV[$i];
		push (@Libs, $ARGV[$i]);
	} elsif ($ARGV[$i] =~ /\.(c|cpp|cc|i|ii|C)$/) {
		$LastCFile = $ARGV[$i];
	}
}

sub GetDefaultOutputFileName {
	my $DefaultOutputFileBase;

	if ($ProgramName =~ /llvm-native-gcc/) {
		$DefaultOutputFileBase = $LastCFile;
	} elsif ($ProgramName =~ /native-build/) {
		$DefaultOutputFileBase = $BytecodeFiles[0];
	}

	my $def = $DefaultOutputFileBase;

	die "Can't figure out name of output file.\n"
		unless $DefaultOutputFileBase
			   && (($ProgramName !~ /native-build/)
				   || $#BytecodeFiles == 0);

	print "Warning: defaulting output file name ",
		"based on '$DefaultOutputFileBase'\n" if $Verbose;

	if ($ProgramName =~ /llvm-native-gcc/) {
		$def =~ s/\.(c|cpp|cc|i|ii|C)$/.o/;
	} elsif ($ProgramName =~ /native-build/) {
		$def =~ s/\.bc$/.$Backend/;
		if ($CompileDontLink) {
			$def .= ".o";
		}
	}

	return $def;
}

# run a command, optionally echoing, and quitting if it fails:
sub run {
	my $command = join(" ", @_);
	print "$command\n" if $Verbose;
	$command =~ s/\"/\\\"/g;
	system $command and die "$0: $command failed";
}

sub LinkBytecodeFilesIntoTemporary {
	my $FinalOutputFileName = shift @_;
	my @BytecodeFiles = @_;

	my $BCFiles = join (" ", @BytecodeFiles);
	my $LinkedBCFile;
	if ($SaveTemps) {
		$LinkedBCFile = "${FinalOutputFileName}.llvm.bc";
	} else {
		$LinkedBCFile = "/tmp/nativebuild-$$.llvm.bc";
	}
	run "llvm-link -o $LinkedBCFile $BCFiles";
	return $LinkedBCFile;
}

sub CompileBytecodeToNative {
	my ($BCFile, $Backend, $OutputFile) = @_;

	my $GeneratedCode;
	if ($Backend eq 'cbe') {
		if ($SaveTemps) {
			$GeneratedCode = "${OutputFile}.c";
		} else {
			$GeneratedCode = "/tmp/nativebuild-$$.c";
		}
		run "llc -march=c -f -o $GeneratedCode $BCFile";
	} elsif ($Backend eq 'llc') {
		if ($SaveTemps) {
			$GeneratedCode = "${OutputFile}.s";
		} else {
			$GeneratedCode = "/tmp/nativebuild-$$.s";
		}
		run "llc -f -o $GeneratedCode $BCFile";
	}
	my $LibDirs = join (" ", @LibDirs);
	my $Libs = join (" ", @Libs);
	run "gcc $GCCOptions $GeneratedCode -o $OutputFile $LibDirs $Libs";
	run "rm $BCFile $GeneratedCode"
		unless $SaveTemps;
}

sub CompileCToNative {
	my ($LLVMGCCCommand, $Backend, $OutputFile) = @_;
	run $LLVMGCCCommand;
	if ($PreprocessOnly) {
		return;
	}
	my $BCFile = "${OutputFile}.llvm.bc";
	if ($CompileDontLink) {
		run "mv ${OutputFile} $BCFile";
	} else { # gccld messes with the output file name
		run "mv ${OutputFile}.bc $BCFile";
	}
	my $GeneratedCode;
	if ($Backend eq 'cbe') {
		$GeneratedCode = "${OutputFile}.cbe.c";
		run "llc -march=c -f -o $GeneratedCode $BCFile";
	} elsif ($Backend eq 'llc') {
		$GeneratedCode = "${OutputFile}.llc.s";
		run "llc -f -o $GeneratedCode $BCFile";
	}
	my $NativeGCCOptions = "";
	if ($CompileDontLink) {
		$NativeGCCOptions = "-c";
	}
	run "gcc $NativeGCCOptions $GeneratedCode -o $OutputFile";
	run "rm ${OutputFile}.llvm.bc $GeneratedCode"
		unless $SaveTemps;
}

# guess the name of the output file, if -o was not specified.
$OutputFile = GetDefaultOutputFileName () unless $OutputFile;
print "Output file is $OutputFile\n" if $Verbose;
# do all the dirty work:
if ($ProgramName eq /native-build/) {
	my $LinkedBCFile = LinkBytecodeFilesIntoTemporary (@BytecodeFiles);
	CompileBytecodeToNative ($LinkedBCFile, $Backend, $OutputFile);
} elsif ($ProgramName =~ /llvm-native-gcc/) {
	# build the llvm-gcc command line.
	$LLVMGCCCommand = join (" ", ("llvm-gcc", @ARGV));
	CompileCToNative ($LLVMGCCCommand, $Backend, $OutputFile);
}

# we're done.
exit 0;

__END__

=pod

=head1 NAME

llvm-native-gcc

=head1 SYNOPSIS

llvm-native-gcc [OPTIONS...] FILE

native-build [OPTIONS...] FILE

=head1 DESCRIPTION

llvm-native-gcc is a wrapper around the LLVM command-line tools which generates
a native object (.o) file by compiling FILE with llvm-gcc, and then running 
an LLVM back-end (CBE by default) over the resulting bytecode, and then
compiling the resulting code to a native object file.

If called as "native-build", it compiles bytecode to native code, and takes
different options.

=head1 OPTIONS

llvm-native-gcc takes the same options as llvm-gcc. All options
except -mllvm-backend=... are passed on to llvm-gcc.

=over 4

=item -mllvm-backend=BACKEND

Use BACKEND for native code generation. 

=item -v

Print command lines that llvm-native-gcc runs.

=item -o FILE

llvm-native-gcc tries to guess the name of the llvm-gcc output file by looking
for this option in the command line. If it can't find it, it finds the last C
or C++ source file named on the command line, and turns its suffix into .o. See
BUGS.

=item -save-temps

Save temporary files used by llvm-native-gcc (and llvm-gcc, and gcc).

=back

=head1 BUGS

llvm-native-gcc only handles the case where llvm-gcc compiles a single
file per invocation.  llvm-native-gcc has weak command-line argument
parsing and is a poor substitute for making gcc/gcc.c do this stuff.

This manual page does not adequately document native-build mode.

llvm-native-gcc is pretty gross because it represents the blind merging of two
other scripts that predated it. It could use some code clean-up.

=head1 SEE ALSO

gcc(1)

=head1 AUTHOR

Brian R. Gaeke

=cut
