[llvm-dev] Error in generating Object Code for implemented assembly vector instructions
hameeza ahmed via llvm-dev
llvm-dev at lists.llvm.org
Sat Aug 26 02:31:43 PDT 2017
i want to emit binary code for the following implemented vector assembly
instructions.
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;
break;
case X86::P_256B_STORE_DWORD: NewOpc = X86::P_256B_STORE_DWORD;
break;
case X86::P_256B_VADD: NewOpc = X86::P_256B_VADD; break;
}
OutMI.setOpcode(NewOpc);
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&)
lib/Support/Unix/Signals.inc:402:11
#1 0x00000000019da4d9 PrintStackTraceSignalHandler(void*)
lib/Support/Unix/Signals.inc:466:1
#2 0x00000000019d8853 llvm::sys::RunSignalHandlers()
lib/Support/Signals.cpp:0:5
#3 0x00000000019da834 SignalHandler(int) lib/Support/Unix/Signals.inc:256:1
#4 0x00007f2f2be14d10 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10d10)
#5 0x00007f2f2adc2267 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35267)
#6 0x00007f2f2adc3eca abort (/lib/x86_64-linux-gnu/libc.so.6+0x36eca)
#7 0x000000000195f6c0 LLVMInstallFatalErrorHandler
lib/Support/ErrorHandling.cpp:133:0
#8 0x0000000000c08966 llvm::X86II::getSizeOfImm(unsigned long)
lib/Target/X86/MCTargetDesc/X86BaseInfo.h:577:29
#9 0x0000000000c04c2a (anonymous
namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst const&,
llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&,
llvm::MCSubtargetInfo const&) const
lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:1512:67
#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
llvm::X86AsmPrinter::EmitAndCountInstruction(llvm::MCInst&)
lib/Target/X86/X86MCInstLower.cpp:106:3
#13 0x00000000007a32dc
llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr const*)
lib/Target/X86/X86MCInstLower.cpp:1849:1
#14 0x0000000000dde226 llvm::AsmPrinter::EmitFunctionBody()
lib/CodeGen/AsmPrinter/AsmPrinter.cpp:943:11
#15 0x0000000000796e81
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
lib/Target/X86/X86AsmPrinter.cpp:73:3
#16 0x000000000104d441
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
lib/CodeGen/MachineFunctionPass.cpp:62:8
#17 0x00000000014766bf llvm::FPPassManager::runOnFunction(llvm::Function&)
lib/IR/LegacyPassManager.cpp:1513:27
#18 0x00000000014769d5 llvm::FPPassManager::runOnModule(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1534:16
#19 0x000000000147716a (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1590:27
#20 0x0000000001476c96 llvm::legacy::PassManagerImpl::run(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1693:16
#21 0x0000000001477681 llvm::legacy::PassManager::run(llvm::Module&)
lib/IR/LegacyPassManager.cpp:1724:3
#22 0x000000000076bbde compileModule(char**, llvm::LLVMContext&)
tools/llc/llc.cpp:530:42
#23 0x000000000076a0c9 main tools/llc/llc.cpp:285:13
#24 0x00007f2f2adada40 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20a40)
#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.
> 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&)
> /lib/Support/Unix/Signals.inc:402:11
> #1 0x00000000019da4d9 PrintStackTraceSignalHandler(void*)
> /lib/Support/Unix/Signals.inc:466:1
> #2 0x00000000019d8853 llvm::sys::RunSignalHandlers()
> /lib/Support/Signals.cpp:0:5
> #3 0x00000000019da834 SignalHandler(int) /lib/Support/Unix/Signals.inc:
> 256:1
> #4 0x00007f6d08f79d10 __restore_rt (/lib/x86_64-linux-gnu/
> libpthread.so.0+0x10d10)
> #5 0x00007f6d07f27267 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35267)
> #6 0x00007f6d07f28eca abort (/lib/x86_64-linux-gnu/libc.so.6+0x36eca)
> #7 0x000000000195f6c0 LLVMInstallFatalErrorHandler
> /lib/Support/ErrorHandling.cpp:133:0
> #8 0x0000000000c08966 llvm::X86II::getSizeOfImm(unsigned long)
> /lib/Target/X86/MCTargetDesc/X86BaseInfo.h:577:29
> #9 0x0000000000c04c2a (anonymous namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst
> const&, llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&,
> llvm::MCSubtargetInfo const&) const /lib/Target/X86/MCTargetDesc/
> X86MCCodeEmitter.cpp:1512:67
> #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 llvm::X86AsmPrinter::EmitAndCountInstruction(llvm::MCInst&)
> /lib/Target/X86/X86MCInstLower.cpp:106:3
> #13 0x00000000007a32dc llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr
> const*) /lib/Target/X86/X86MCInstLower.cpp:1738:1
> #14 0x0000000000dde226 llvm::AsmPrinter::EmitFunctionBody()
> /lib/CodeGen/AsmPrinter/AsmPrinter.cpp:943:11
> #15 0x0000000000796e81 llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
> /lib/Target/X86/X86AsmPrinter.cpp:73:3
> #16 0x000000000104d441 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> /lib/CodeGen/MachineFunctionPass.cpp:62:8
> #17 0x00000000014766bf llvm::FPPassManager::runOnFunction(llvm::Function&)
> /lib/IR/LegacyPassManager.cpp:1513:27
> #18 0x00000000014769d5 llvm::FPPassManager::runOnModule(llvm::Module&)
> /lib/IR/LegacyPassManager.cpp:1534:16
> #19 0x000000000147716a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&)
> /lib/IR/LegacyPassManager.cpp:1590:27
> #20 0x0000000001476c96 llvm::legacy::PassManagerImpl::run(llvm::Module&)
> /lib/IR/LegacyPassManager.cpp:1693:16
> #21 0x0000000001477681 llvm::legacy::PassManager::run(llvm::Module&)
> /lib/IR/LegacyPassManager.cpp:1724:3
> #22 0x000000000076bbde compileModule(char**, llvm::LLVMContext&)
> /tools/llc/llc.cpp:530:42
> #23 0x000000000076a0c9 main /tools/llc/llc.cpp:285:13
> #24 0x00007f6d07f12a40 __libc_start_main (/lib/x86_64-linux-gnu/libc.
> so.6+0x20a40)
> #25 0x0000000000769b99 _start (/bin/llc+0x769b99)
> Stack dump:
> 0. Program arguments: /bin/llc -x86-asm-syntax=intel -debug
> -p-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 should I do? Please help.
>
>
>
>
>
> On Thu, Aug 24, 2017 at 1:35 AM, hameeza ahmed <hahmed2305 at gmail.com>
> wrote:
>
>> Hello,
>>
>> I have implemented some vector instructions ( greater vector width) in
>> LLVM x86 backend. The llc is generating correct assembly. however to
>> execute that on some target machine. i need object file. What changes do i
>> need to do? do i need to put these new instructions and register info in MC
>> framework to generate object code from .s assembly file?
>>
>>
>> Please help. I am stuck at this point.
>>
>> Thank You
>> Regards
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170826/c0eb60b4/attachment.html>
More information about the llvm-dev
mailing list