Hi,
An error occures when I try to compile a .c file using the backend I am
writing.
That's possibly your first mistake. Myself, I'd only worry about C
files when I was confident the backend was mostly functional (yours
clearly isn't). Until then, I'd perform all tests via llc and .ll
files.
LLVM ERROR: Cannot select: 0x3e13290: i32 = FrameIndex<3> [ID=7]
In function: main
Do you have any idea why I am getting this error and how can I fix this?
You have neither a TableGen pattern nor C++ code to deal with an
SDNode representing a FrameIndex (i.e. local variable). Your best bet
is to look at how existing backends cope with this[*] and adapt their
solutions to your architecture.
If you've not done that yet, do it. If you have, then you need to
describe what you've done, what debugging information you've managed
to retrieve from the failure, and any conjectures you've got for why
it's not working.
I don't particularly mean to be short, but repeated requests for
"detailed explanations" are going to yield less and less responses as
time goes on. We don't have time to write essays or solve each problem
that comes up writing a backend, we all have our own jobs to do as
well. The expectation is that people will learn how to solve routine
issues on their own.
On the other hand, someone who has clearly spent time trying to work
out what's going wrong and is asking as a last resort will get a far
more positive reaction from the community.
Cheers.
Tim.
[*] Hint: try a program like
define i32* @foo() {
%addr = alloca i32
ret i32* %addr
}
The following commands are very useful in situations like these:
$ llc -view-isel-dags
(shows what goes into the phase that's failing for you (ISel))
$ llc -view-sched-dags
(shows what comes out).