[llvm] [Xtensa] Implement lowering Mul/Div/Shift operations. (PR #99981)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 04:14:07 PDT 2024
================
@@ -665,12 +693,30 @@ SDValue XtensaTargetLowering::getAddrPCRel(SDValue Op,
SDValue XtensaTargetLowering::LowerConstantPool(ConstantPoolSDNode *CP,
SelectionDAG &DAG) const {
EVT PtrVT = getPointerTy(DAG.getDataLayout());
+ auto C = const_cast<Constant *>(CP->getConstVal());
+ auto T = const_cast<Type *>(CP->getType());
SDValue Result;
- if (!CP->isMachineConstantPoolEntry()) {
- Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(),
- CP->getOffset());
+
+ // Do not use constant pool for aggregate or vector constant types,
+ // in such cases create global variable, for example to store tabel
+ // when we lower CTTZ operation.
+ if (T->isAggregateType() || T->isVectorTy()) {
+ auto AFI = DAG.getMachineFunction().getInfo<XtensaFunctionInfo>();
+ auto M = const_cast<Module *>(
+ DAG.getMachineFunction().getFunction().getParent());
+ auto GV = new GlobalVariable(
+ *M, T, /*isConstant=*/true, GlobalVariable::InternalLinkage, C,
+ Twine(DAG.getDataLayout().getPrivateGlobalPrefix()) + "CP" +
+ Twine(DAG.getMachineFunction().getFunctionNumber()) + "_" +
----------------
arsenm wrote:
DAG.getMachineFunction() is repeated many times, use an MF variable
https://github.com/llvm/llvm-project/pull/99981
More information about the llvm-commits
mailing list