Error in generating Object Code for implemented assembly vector instructions

i want to emit binary code for the following implemented vector assembly
P_256B_LOAD_DWORD R_0_R2048b_0, pword ptr [rip + b]
P_256B_LOAD_DWORD R_0_R2048b_1, pword ptr [rip + c]
P_256B_VADD R_0_R2048b_0, R_0_R2048b_1, R_0_R2048b_0
P_256B_STORE_DWORD pword ptr [rip + a], R_0_R2048b_0

I added the following lines in X86MCInstLower.cpp;
unsigned NewOpc;
      switch (OutMI.getOpcode()) {
      default: llvm_unreachable("Invalid opcode");
      case X86::P_256B_LOAD_DWORD: NewOpc = X86::P_256B_LOAD_DWORD;
      case X86::P_256B_STORE_DWORD: NewOpc = X86::P_256B_STORE_DWORD;
      case X86::P_256B_VADD: NewOpc = X86::P_256B_VADD; break;

when i used the command:

llc -x86-asm-syntax=intel -debug -p-enabled=true -filetype=obj
sum-vec03.ll>objpon 2>&1
i am getting the following error:

********** COMPUTING STACKMAP LIVENESS: foo **********
Unknown immediate size
UNREACHABLE executed at lib/Target/X86/MCTargetDesc/X86BaseInfo.h:574!
#0 0x00000000019d9fec llvm::sys::PrintStackTrace(llvm::raw_ostream&)
#1 0x00000000019da4d9 PrintStackTraceSignalHandler(void*)
#2 0x00000000019d8853 llvm::sys::RunSignalHandlers()
#3 0x00000000019da834 SignalHandler(int) lib/Support/Unix/
#4 0x00007f2f2be14d10 __restore_rt
#5 0x00007f2f2adc2267 gsignal (/lib/x86_64-linux-gnu/
#6 0x00007f2f2adc3eca abort (/lib/x86_64-linux-gnu/
#7 0x000000000195f6c0 LLVMInstallFatalErrorHandler
#8 0x0000000000c08966 llvm::X86II::getSizeOfImm(unsigned long)
#9 0x0000000000c04c2a (anonymous
namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst const&,
llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&,
llvm::MCSubtargetInfo const&) const
#10 0x00000000015884b3 llvm::MCELFStreamer::EmitInstToData(llvm::MCInst
const&, llvm::MCSubtargetInfo const&) lib/MC/MCELFStreamer.cpp:478:26
#11 0x00000000015aadc0 llvm::MCObjectStreamer::EmitInstruction(llvm::MCInst
const&, llvm::MCSubtargetInfo const&) lib/MC/MCObjectStreamer.cpp:245:5
#12 0x00000000007a036b
#13 0x00000000007a32dc
llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr const*)
#14 0x0000000000dde226 llvm::AsmPrinter::EmitFunctionBody()
#15 0x0000000000796e81
#16 0x000000000104d441
#17 0x00000000014766bf llvm::FPPassManager::runOnFunction(llvm::Function&)
#18 0x00000000014769d5 llvm::FPPassManager::runOnModule(llvm::Module&)
#19 0x000000000147716a (anonymous
#20 0x0000000001476c96 llvm::legacy::PassManagerImpl::run(llvm::Module&)
#21 0x0000000001477681 llvm::legacy::PassManager::run(llvm::Module&)
#22 0x000000000076bbde compileModule(char**, llvm::LLVMContext&)
#23 0x000000000076a0c9 main tools/llc/llc.cpp:285:13
#24 0x00007f2f2adada40 __libc_start_main
#25 0x0000000000769b99 _start (/bin/llc+0x769b99)
Stack dump:
0. Program arguments: /bin/llc -x86-asm-syntax=intel -debug
-pim-enabled=true -filetype=obj sum-vec03.ll
1. Running pass 'Function Pass Manager' on module 'sum-vec03.ll'.
2. Running pass 'X86 Assembly Printer' on function '@foo'

what to do now? I am stuck here. Please help.

Please help. How to resolve above mentioned issues.

Hi Ahmed,

Please help. How to resolve above mentioned issues.

Pinging a question after 10 hours is not good practice in LLVM. The
developer policy (LLVM Developer Policy — LLVM 18.0.0git documentation)
suggests roughly weekly for patches, and I see no reason questions on
llvm-dev should be any different.

In general, if I can be blunt, I don't get the impression you try to
solve your issues independently before asking here. From what I can
see your first reaction on seeing an error is to ask on this list what
code needs to be modified to fix your problem.

We understand that you're probably new to this code, but virtually
everyone responding here is doing it either in their own time or at
best with an employer's "engage with OSS" blessing. You're going to
get a lot more positive responses if you appear to have investigated
obvious possibilities and actually debugged code before asking for a
quick fix. You should describe what you've done to work out where the
source of the error is, and give specific details on why you're stuck

We really want to help, but we're inevitably going to prioritise
questions that suggest someone is going to become a useful part of the
LLVM community. Independent thinking is a big part of that (at least
for me).



ok. you have got a wrong impression. i am trying to solve it myself as well. its just this that i find difficulty in reaching the start point of binary code generation as there are no .td files involved in this which means i have to make changes in .cpp directly. now i am looking where the specific encoding for x86 is implemented in these files. once i get that, then i won’t trouble people more i guess. Also, before asking question i used to check the llvm group to see whether someone has asked it before because there is no good help on google or other forums. no such tutorial either.

Thank you.