Example #1
0
void compile_llvm_module_to_assembly(llvm::Module &module, Internal::LLVMOStream& out) {
    emit_file(module, out, llvm::TargetMachine::CGFT_AssemblyFile);
}
Example #2
0
void compile_llvm_module_to_object(llvm::Module &module, Internal::LLVMOStream& out) {
    emit_file(module, out, llvm::TargetMachine::CGFT_ObjectFile);
}
Example #3
0
/*
 * runtrace - Run trace file on test and reference shells
 *            Return 0 if results are different, 1 if identical
  */
int runtrace(char *tracefile)
{ 
    int status;
    char buf[MAXBUF];
    struct stat statbuf;

    if (stat(tracefile, &statbuf) < 0) {
		printf("%s: trace file not found", tracefile);
		exit(1);
    }

    /* Run the student's test shell */
    if (sandboxing)
		sprintf(buf, "./runtrace -x -s %s -f %s > %s\n", 
				shellprog, tracefile, test_raw_outfile);
    else
		sprintf(buf, "./runtrace -s %s -f %s > %s\n", 
				shellprog, tracefile, test_raw_outfile);

    if (system(buf) != 0) {
		printf("sdriver unable to run %s\n", buf);
    }
    
    /* Run the reference shell */
    sprintf(buf, "./runtrace -s ./tshref -f %s > %s\n", 
		    tracefile, ref_raw_outfile);
    if (system(buf) != 0) {
		emit_file(ref_raw_outfile);
		printf("sdriver unable to run %s\n", buf);
		delete_tmpfiles();
		exit(1);
    }
    
    /* Filter the test and reference outputs */
    sprintf(buf, "perl -e '%s' < %s | sort > %s", 
		    PERLPROG, test_raw_outfile, test_filtered_outfile);
    system(buf);
    
    sprintf(buf, "perl -e '%s' < %s | sort > %s", 
		    PERLPROG, ref_raw_outfile, ref_filtered_outfile);
    system(buf);
    
    /* Diff the filtered output files */
    sprintf(buf, "diff %s %s > %s\n", 
		    test_filtered_outfile, ref_filtered_outfile, diff_filtered_outfile);
    status = system(buf);
    
    /* Filtered output files were different */
    if (status != 0) {
		sprintf(buf, "diff %s %s > %s\n", 
				test_raw_outfile, ref_raw_outfile, diff_raw_outfile);
		system(buf);

		printf("Oops: test and reference outputs for %s differed.\n", 
		       tracefile);
		printf("\n");

		printf("Test output:\n");
		emit_file(test_raw_outfile);
		printf("\n");

		printf("Reference output:\n");
		emit_file(ref_raw_outfile);
		printf("\n");

		printf("Output of 'diff test reference':\n");
		emit_file(diff_raw_outfile);
		printf("\n");

		return 0;
}
    
    /* Filtered output files were identical */
    if (verbose) {
		printf("Success: The test and reference outputs for %s matched!\n", tracefile);
    }
    if (verbose > 1) {
		printf("Test output:\n");
		emit_file(test_raw_outfile);
		printf("\n");
		printf("Reference output:\n");
		fflush(stdout);
		emit_file(ref_raw_outfile);
		printf("\n");
    }

    return 1;
}
Example #4
0
void compile_llvm_module_to_native(llvm::Module *module,
                                   const std::string &object_filename,
                                   const std::string &assembly_filename) {
    emit_file(module, object_filename, llvm::TargetMachine::CGFT_ObjectFile);
    emit_file(module, assembly_filename, llvm::TargetMachine::CGFT_AssemblyFile);
}
Example #5
0
void compile_llvm_module_to_assembly(llvm::Module *module, const std::string &filename) {
    emit_file(module, filename, llvm::TargetMachine::CGFT_AssemblyFile);
}
Example #6
0
void compile_llvm_module_to_object(llvm::Module *module, const std::string &filename) {
    emit_file(module, filename, llvm::TargetMachine::CGFT_ObjectFile);
}