MachineConstantPoolValue

In the ARM backend, functions (and other 32 bit constants) are placed
in a pool and loaded when needed.

A problem with this is that ".weak" directives must be printed in the
pool. This is not supported in the standard printer, so I think that I
have found the first use for MachineConstantPoolValue :slight_smile:

Creating the constant is easy, but I have two problems:

1) what are the methods getExistingMachineCPValue and
AddSelectionDAGCSEId supposed to do?

2) printing is hard because we are outside the AsmPrinter.

In my current hack I am printing from
ARMAsmPrinter::EmitMachineConstantPoolValue :frowning:

Since this problem might also be significant to x86 (see my previous
email), maybe we should just teach the pool printer to emit ".weak"
directives...

Best Regards,
Rafael

P.S.: rest assured that what is attached is just a demo hack and will
not be committed :slight_smile:

llvm-pool-hack.patch (4.26 KB)

ARMAsmPrinter.h (547 Bytes)

In the ARM backend, functions (and other 32 bit constants) are placed
in a pool and loaded when needed.

Has this approach been replaced with your later constant pool patch?

-Chris

A problem with this is that ".weak" directives must be printed in the
pool. This is not supported in the standard printer, so I think that I
have found the first use for MachineConstantPoolValue :slight_smile:

Creating the constant is easy, but I have two problems:

1) what are the methods getExistingMachineCPValue and
AddSelectionDAGCSEId supposed to do?

2) printing is hard because we are outside the AsmPrinter.

In my current hack I am printing from
ARMAsmPrinter::EmitMachineConstantPoolValue :frowning:

Since this problem might also be significant to x86 (see my previous
email), maybe we should just teach the pool printer to emit ".weak"
directives...

Best Regards,
Rafael

P.S.: rest assured that what is attached is just a demo hack and will
not be committed :slight_smile:

-Chris

Yes. The constant pool patch solves the problem in a much simpler way.

Best Regards,
Rafael