Adding the new architecture to the Triple class
An instance of the Triple class represents the target platform LLVM is producing code for. To support a new architecture, the first task is to extend the Triple class. In the llvm/include/llvm/TargetParser/Triple.h file, add a member to the ArchType enumeration along with a new predicate:
class Triple {
public:
enum ArchType {
// Many more members
m88k, // M88000 (big endian): m88k
};
/// Tests whether the target is M88k.
bool isM88k() const {
return getArch() == Triple::m88k;
}
// Many more methods
}; Inside the llvm/lib/TargetParser/Triple.cpp file, there are many methods that use the ArchType enumeration. You need to extend all of them; for example, in the getArchTypeName() method, you need to add a new case statement as follows...