[LLVMdev] jump table x constant pool

Evan Cheng evan.cheng at apple.com
Thu Oct 19 22:21:55 PDT 2006


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

On Oct 19, 2006, at 4:06 AM, Rafael EspĂ­ndola wrote:

> 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 :-)
>
> 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
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list