jump table x constant pool

I had some problems adding the address of a jump table to the constant
pool. The problem is that the address of a jump table is not a
GlobalValue.Currently I decided to expand BRIND so that I can work on
simpler problems :slight_smile:

A small brain dump on the issue:
GlobalValues are currently used to represent functions and global
variables. Maybe we could also use then for anything that will have a
label in the final assembly: functions, global variables, basic
blocks, jump tables and constant pools.

If we do so it would be very easy to add a jump table to a constant
pool (analogous to adding a global variable). It would also be
possible to add basic blocks, so maybe we could merge jump tables and
constant pools in one class?

Best Regards,
Rafael

Sounds like you need to define a machine specific constantpool value. Take a look at MachineConstantPoolValue in llvm/CodeGen/MachineConstantPool.h

e.g.

class ARMConstantPoolValue : public MachineConstantPoolValue {
   unsigned JTIndex;
   GlobalValue *GV;
...
};

Then in your lowering routine you can do DAG.getTargetConstantPool(new ARMConstantPoolValue, MVT::i32, alignment)

Make sure you define getExistingMachineCPValue() and AddSelectionDAGCSEId() correctly. The former is called by getConstantPoolIndex() to look for a duplicate entry in the constant pool. The later is used by SelectionDAG::getConstantPool().

Evan