llvm::Triple error in new backend

Hi,

I try to write a new backend. At the moment I run into a compiler error and don't know how I can solve this problem.

Like several other targets I have a file 'mybackendTargetInfo.cpp' in the subdirectory 'TargetInfo'. The content of this file is:

#include "mybackend.h"
#include "llvm/Module.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;

Target llvm::TheMybackendTarget;

extern "C" void LLVMInitializeMybackendTargetInfo() {
  RegisterTarget<Triple::mybackend> X(TheMybackendTarget, "mybackend", "mybackend");
}

Nothing special I think.

The error message of the compiler is:
llvm[1]: Compiling mybackendTargetInfo.cpp for Release+Asserts build
synzenTargetInfo.cpp:17:26: error: no member named 'mybackend' in 'llvm::Triple'
  RegisterTarget<Triple::mybackend> X(TheMybackendTarget, "mybackend", "mybackend");
                 ~~~~~~~~^
1 error generated.
make[1]: *** [/dev/llvm-3.1/lib/Target/mybackend/TargetInfo/Release+Asserts/mybackendTargetInfo.o] Error 1
make: *** [all] Error 1

I think I understand the error message, but I don't know what I have to change or add. I tried to copy as much as possible from running backends to avoid errors - but I missed :wink:

Is there something in the target descriptions (.td files) I have to change?

I would be happy about every hint.

Thanks a lot,
Nico

Hi,

I try to write a new backend. At the moment I run into a compiler error and don't know how I can solve this problem.

Like several other targets I have a file 'mybackendTargetInfo.cpp' in the subdirectory 'TargetInfo'. The content of this file is:

#include "mybackend.h"
#include "llvm/Module.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;

Target llvm::TheMybackendTarget;

extern "C" void LLVMInitializeMybackendTargetInfo() {
  RegisterTarget<Triple::mybackend> X(TheMybackendTarget, "mybackend", "mybackend");
}

Nothing special I think.

The error message of the compiler is:
llvm[1]: Compiling mybackendTargetInfo.cpp for Release+Asserts build
synzenTargetInfo.cpp:17:26: error: no member named 'mybackend' in 'llvm::Triple'
  RegisterTarget<Triple::mybackend> X(TheMybackendTarget, "mybackend", "mybackend");
                 ~~~~~~~~^
1 error generated.
make[1]: *** [/dev/llvm-3.1/lib/Target/mybackend/TargetInfo/Release+Asserts/mybackendTargetInfo.o] Error 1
make: *** [all] Error 1

You need to add your backend to the enumeration in llvm/ADT/Triple.h
You will also need to teach the functions in lib/Support/Triple.cpp
about your backend.

-Tom