bindists are now some way towards working
[ghc.git] / driver / test_mangler
1 #! /usr/bin/perl
2 # a simple wrapper to test a .s-file mangler
3 # reads stdin, writes stdout
4
5 push(@INC,"/net/dazdak/BUILDS/gransim-4.04/i386-unknown-linux/ghc/driver");
6
7 $TargetPlatform = $ARGV[0]; shift; # nice error checking, Will
8
9 require("ghc-asm.prl") || die "require mangler failed!\n";
10
11 $SpX86Mangling = 1;
12 $StolenX86Regs = 4;
13
14 open(INP, "> /tmp/mangle1.$$") || die "Can't open tmp file 1\n";
15 while (<>) {
16     print INP $_;
17 }
18 close(INP) || die "Can't close tmp file 1";
19
20 &mangle_asm("/tmp/mangle1.$$", "/tmp/mangle2.$$");
21
22 open(INP, "< /tmp/mangle2.$$") || die "Can't open tmp file 2\n";
23 while (<INP>) {
24     print STDOUT $_;
25 }
26 close(INP) || die "Can't close tmp file 2";
27
28 unlink("/tmp/mangle1.$$", "/tmp/mangle2.$$");
29 exit(0);