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/ADT/Triple.h
file, you add a member to the ArchType
enumeration and 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/Support/Triple.cpp
file, there are numerous 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:
  switch (Kind) { // Many...