From: Mehwish Nagda Date: Thu, 25 Jul 2002 17:22:48 +0000 (+0000) Subject: changed implementation of LLVM BYTECODE Length X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=0009c2e8b38478eef745c777eafcca511cabc246;p=oota-llvm.git changed implementation of LLVM BYTECODE Length git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3089 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp index 3ca8b165823..4a99cb3c4ca 100644 --- a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp +++ b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp @@ -10,8 +10,7 @@ #include "llvm/Pass.h" #include "llvm/Bytecode/Writer.h" #include -#include -#include + using std::ostream; namespace { @@ -41,7 +40,7 @@ namespace { // as the underlying streambuf to write the data to. This streambuf formats // the output as .byte directives for sparc output. // - class osparcasmstream : public ostream { + class osparcasmstream : public std::ostream { sparcasmbuf sb; public: typedef char char_type; @@ -49,7 +48,7 @@ namespace { typedef std::streampos pos_type; typedef std::streamoff off_type; - explicit osparcasmstream(ostream &On) : ostream(&sb), sb(On) { } + explicit osparcasmstream(std::ostream &On) : std::ostream(&sb), sb(On) { } sparcasmbuf *rdbuf() const { return const_cast(&sb); @@ -63,32 +62,31 @@ namespace { SparcBytecodeWriter(std::ostream &out) : Out(out) {} const char *getPassName() const { return "Emit Bytecode to Sparc Assembly";} - + virtual bool run(Module &M) { // Write bytecode out to the sparc assembly stream + Out << "\n\n!LLVM BYTECODE OUTPUT\n\t.section \".rodata\"\n\t.align 8\n"; Out << "\t.global LLVMBytecode\n\t.type LLVMBytecode,#object\n"; Out << "LLVMBytecode:\n"; //changed --anand, to get the size of bytecode - std::ostringstream Ostr; - osparcasmstream OS(Ostr); + osparcasmstream OS(Out); WriteBytecodeToFile(&M, OS); - //compute length: count number of "." - std::string myString=Ostr.str(); - int llvm_len=0; - for(std::string::iterator si=myString.begin(), se=myString.end(); si!=se; si++) - if(*si == '.') - llvm_len++; - - //now put Ostr into Out - //count no of - Out<