[llvm-commits] [llvm] r78802 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc

Chris Lattner clattner at apple.com
Wed Aug 12 20:49:45 PDT 2009


On Aug 12, 2009, at 8:31 PM, Daniel Dunbar wrote:

>> +  /// implementation.  This invokes the specified function to do the
>> +  /// construction.  Usage:
>> +  ///
>> +  /// extern "C" void LLVMInitializeFooTarget() {
>> +  ///   extern Target TheFooTarget;
>> +  ///   RegisterAsmInfoFn X(TheFooTarget, TheFunction);
>> +  /// }
>> +  struct RegisterAsmInfoFn {
>> +    RegisterAsmInfoFn(Target &T, Target::AsmInfoCtorFnTy Fn) {
>> +      TargetRegistry::RegisterAsmInfo(T, Fn);
>> +    }
>> +  };
>
> I find this more confusing than helpful, why not just have targets
> that need to implement their own constructor call TargetRegistry
> directly, instead of wrapping the call in a struct?
>
> Alternately, if this is something we expect many clients to need to
> do, perhaps we should find a way to have the TargetRegistry help out.

I don't have a strong opinion about it.  The only reason I did this  
was to make the various "register" calls more consistent and  
idiomatic.  If you want me to change it, I'm happy to do so.

-Chris



More information about the llvm-commits mailing list