[llvm-commits] [PATCH] Review request: MC access to target and subtarget machine info

Carter, Jack jcarter at mips.com
Mon Dec 3 14:35:58 PST 2012


That doesn't help me. I need to set the PIC flag with direct object emissions regardless of whether llvm-mc or just llc is used.

Or have I misunderstood?

Anyway, AsmPrinter is initialized using TargetMachine and that is where it is getting Subtarget. It is in my eye the same thing as I was doing, but I am good with just using Subtarget.

The non-direct object AsmPrinter is suppose to know if it is PIC or not  in order to print out ".option pic0" for non-shared (which we are failing to do btw - bug)? I can just catch the pic'ness when MipsAsmPrinter is created or better yet when Subtarget is created.

Jack
________________________________
From: Jim Grosbach [grosbach at apple.com]
Sent: Monday, December 03, 2012 12:38 PM
To: Carter, Jack
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [PATCH] Review request: MC access to target and subtarget machine info

PIC vs. non-PIC is a different sort of thing. Often, that sort of thing for .o file flags are handled via assembler directives (see, for example, the .cpu and .fpu directives in ARM, for example).

The whole ARMAsmPrinter::emitAttributes() may be a useful example, as what it's doing seems pretty similar to what you're looking for. It uses the MCSubtargetInfo for lots of its information, but not all of it.

-Jim

On Dec 3, 2012, at 12:31 PM, "Carter, Jack" <jcarter at mips.com<mailto:jcarter at mips.com>> wrote:


________________________________
So you are saying is that SubTargetInfo is OK and anything that such as PIC/CPIC that I need would just get added to that?

Yes, I need to know and mark e_flags with EF_MIPS_PIC if we are not compiling static (non-shared).

I would be good with that.

Jack


From: Jim Grosbach [grosbach at apple.com<mailto:grosbach at apple.com>]
Sent: Monday, December 03, 2012 12:04 PM
To: Carter, Jack
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [PATCH] Review request: MC access to target and subtarget machine info

Hi Jack,

TargetMachine is deliberately not available in any MC layer code, as it's part of the CodeGen layer.

You probably want something along the lines of the features bit mask in MCSubtargetInfo. The ARM assembler has some examples of using that for related things.

-Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121203/62af1a8e/attachment.html>


More information about the llvm-commits mailing list