As LLVM generates code for different architectures, it seems obvious to use clang to cross-compile. The obstacle here is that LLVM does not provide all the required parts – for
Read MoreCategory: ITCertification Exams
CROSS-COMPILING ON OTHER SYSTEMS – Beyond Instruction Selection
Some distributions, such as Fedora, only provide cross-compiling support for bare-metal targets such as the Linux kernel, but the header and library files needed for user land applications are not
Read MoreTargeting a different CPU architecture – Beyond Instruction Selection
Today, many small computers, such as the Raspberry Pi, are in use despite having only limited resources. Running a compiler on such a computer is often not possible or it
Read MoreBuilding the M88k target with clang integration – Beyond Instruction Selection
We’re almost done with the implementation for integrating M88k into clang. The last step is to add the new clang files that we have added into their corresponding CMakeLists.txt file,
Read MoreImplementing the toolchain support for M88k within clang – Beyond Instruction Selection-2
StringRef m88k::getM88kTargetCPU(const ArgList &Args) {Arg *A = Args.getLastArg(options::OPT_m88000, options::OPT_m88100, options::OPT_m88110, options::OPT_mcpu_EQ);if (!A)return StringRef();switch (A->getOption().getID()) {case options::OPT_m88000:return “mc88000”;case options::OPT_m88100:return “mc88100”;case options::OPT_m88110:return “mc88110”;case options::OPT_mcpu_EQ:return normalizeCPU(A->getValue());default:llvm_unreachable(“Impossible option ID”);}} StringRef m88k::getM88kTuneCPU(const ArgList &Args) {if
Read MoreImplementing the toolchain support for M88k within clang – Beyond Instruction Selection-1
The final portion of the M88k target integration within clang will be to implement toolchain support for our target. Like before, we’ll need to create a header file for toolchain
Read MoreImplementing ABI support for M88k within clang – Beyond Instruction Selection
Now, we need to add ABI support within the frontend for clang, which allows us to produce code specific to the M88k target from the frontend: std::unique_ptr createM88kTargetCodeGenInfo(CodeGenModule &CGM); Now,
Read MoreImplementing the driver integration within clang – Beyond Instruction Selection-4
const char *const M88kTargetInfo::GCCRegNames[] = {“r0”, “r1”, “r2”, “r3”, “r4”, “r5”, “r6”, “r7”,“r8”, “r9”, “r10”, “r11”, “r12”, “r13”, “r14”, “r15”,“r16”, “r17”, “r18”, “r19”, “r20”, “r21”, “r22”, “r23”,“r24”, “r25”, “r26”, “r27”,
Read MoreImplementing the driver integration within clang – Beyond Instruction Selection-3
bool M88kTargetInfo::setCPU(const std::string &Name) {StringRef N = Name;CPU = llvm::StringSwitch(N).Case(“generic”, CK_88000).Case(“mc88000”, CK_88000).Case(“mc88100”, CK_88100).Case(“mc88110”, CK_88110).Default(CK_Unknown);return CPU != CK_Unknown;} static constexpr llvm::StringLiteral ValidCPUNames[] = {{“generic”}, {“mc88000”}, {“mc88100”}, {“mc88110”}};void M88kTargetInfo::fillValidCPUList(SmallVectorImpl &Values) const {Values.append(std::begin(ValidCPUNames),
Read MoreImplementing the driver integration within clang – Beyond Instruction Selection-2
} // namespace targets} // namespace clangendif // LLVM_CLANG_LIB_BASIC_TARGETS_M88K_H include “M88k.h”include “clang/Basic/Builtins.h”include “clang/Basic/Diagnostic.h”include “clang/Basic/TargetBuiltins.h”include “llvm/ADT/StringExtras.h”include “llvm/ADT/StringRef.h”include “llvm/ADT/StringSwitch.h”include “llvm/TargetParser/TargetParser.h”include namespace clang {namespace targets {M88kTargetInfo::M88kTargetInfo(const llvm::Triple &Triple,const TargetOptions &): TargetInfo(Triple) {
Read More