//===-- ModuloScheduling.cpp - ModuloScheduling ----------------*- C++ -*-===////// The LLVM Compiler Infrastructure//// This file was developed by the LLVM research group and is distributed under// the University of Illinois Open Source License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// ////===----------------------------------------------------------------------===//#define DEBUG_TYPE "ModuloSched"#include"ModuloScheduling.h"#include"llvm/CodeGen/MachineFunction.h"#include"llvm/CodeGen/Passes.h"#include"llvm/Support/CFG.h"#include"llvm/Target/TargetSchedInfo.h"#include"Support/Debug.h"#include"Support/GraphWriter.h"#include"Support/StringExtras.h"#include<vector>#include<utility>#include<iostream>#include<fstream>#include<sstream>usingnamespacellvm;/// Create ModuloSchedulingPass///FunctionPass*llvm::createModuloSchedulingPass(TargetMachine&targ){DEBUG(std::cerr<<"Created ModuloSchedulingPass\n");returnnewModuloSchedulingPass(targ);}template<typenameGraphType>staticvoidWriteGraphToFile(std::ostream&O,conststd::string&GraphName,constGraphType>){std::stringFilename=GraphName+".dot";O<<"Writing '"<<Filename<<"'...";std::ofstreamF(Filename.c_str());if(F.good())WriteGraph(F,GT);elseO<<" error opening file for writing!";O<<"\n";};namespacellvm{template<>structDOTGraphTraits<MSchedGraph*>:publicDefaultDOTGraphTraits{staticstd::stringgetGraphName(MSchedGraph*F){return"Dependence Graph";}