[LLVMdev] Patch: MSIL backend global pointers initialization
Anton Korobeynikov
anton at korobeynikov.info
Fri Apr 3 15:12:11 PDT 2009
Hi, Artur
Minor comments:
> +// Comparision for std::lower_bound used in
> MSILWriter::printExternals()
> +static bool CompareInstructions(Instruction *A,Instruction *B)
> +{
Put brace on the same line as function def.
> + if ( !F->use_empty() ) // Print only if used
> + {
Likewise. Plus use "if (foo)" instead of "if ( foo )". All code around
uses the first variant.
> + if (F->isVarArg()){
Add space before "{"
> + std::vector<Instruction*> ivec;
> + Value::use_const_iterator e = I->use_end();
> + for(Value::use_const_iterator i = I->use_begin(); i!=e;
> ++i){
Likewise. Also, put space before "("
> + Instruction *instr =
> + const_cast<Instruction*>(dynamic_cast<const
> Instruction*>(*i));
Sounds hacky. Why do you need to cast away const? Maybe you just need
use_iterator instead?
> + if(!instr) continue;
See above.
> + //We want each signature just once
> + std::vector<Instruction*>::iterator ins =
> + std::lower_bound(ivec.begin(), ivec.end(), instr,
> + CompareInstructions);
> + if(ins!=ivec.end() && instr->isSameOperationAs(*ins))
> continue;
Likewise.
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
More information about the llvm-dev
mailing list