I have been working on a LLVM backend for the MicroBlaze soft-processor: http://www.xilinx.com/tools/microblaze.htm http://en.wikipedia.org/wiki/MicroBlaze Attached is the initial MicroBlaze patch. It does the following: 1. Adds mblaze as a target in configure and configure.ac 2. Adds mblaze specific intrinsics in include/llvm/IntrinsicsMBlaze.td and include/llvm/Intrinsics.td 3. Adds mblaze triple support in include/llvm/ADT/Triple.h and lib/Support/Triple.cpp 4. Adds mblaze backend support in lib/Target/MBlaze 5. Adds mblaze test cases in test/CodeGen/MBlaze Currently the MicroBlaze backend generates MicroBlaze assembly which compiles successfully using the MicroBlaze assembler. Many small to medium sized test cases seem to compile and work but extensive testing has not yet been done. I have not supplied any major patches to the LLVM development team before so if the patch needs to be reworked then let me know and I will take care of it. -------------- next part -------------- A non-text attachment was scrubbed... Name: 2010-01-29-mblaze.patch.gz Type: application/x-gzip Size: 46010 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100129/7f762373/attachment.bin> -------------- next part -------------- -- Wesley Peck University of Kansas SLDG Laboratory
Hello, Wesley> Attached is the initial MicroBlaze patch. It does the following: > 1. Adds mblaze as a target in configure and configure.ac > 2. Adds mblaze specific intrinsics in include/llvm/IntrinsicsMBlaze.td and include/llvm/Intrinsics.td > 3. Adds mblaze triple support in include/llvm/ADT/Triple.h and lib/Support/Triple.cpp > 4. Adds mblaze backend support in lib/Target/MBlaze > 5. Adds mblaze test cases in test/CodeGen/MBlazeThanks, I'll take care about review of this patch. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Jan 29, 2010, at 9:42 AM, Wesley Peck wrote:> I have been working on a LLVM backend for the MicroBlaze soft-processor: > http://www.xilinx.com/tools/microblaze.htm > http://en.wikipedia.org/wiki/MicroBlazeVery Cool!> Attached is the initial MicroBlaze patch. It does the following: > 1. Adds mblaze as a target in configure and configure.ac > 2. Adds mblaze specific intrinsics in include/llvm/IntrinsicsMBlaze.td and include/llvm/Intrinsics.td > 3. Adds mblaze triple support in include/llvm/ADT/Triple.h and lib/Support/Triple.cpp > 4. Adds mblaze backend support in lib/Target/MBlaze > 5. Adds mblaze test cases in test/CodeGen/MBlaze > > Currently the MicroBlaze backend generates MicroBlaze assembly which compiles successfully using the MicroBlaze assembler. Many small to medium sized test cases seem to compile and work but extensive testing has not yet been done.Your patch looks very clean. Some comments: - You don't need the -mb-has-* options in MBlazeSubtarget.cpp. You can pass -mattr=+mul,-div to llc and ParseSubtargetFeatures will take care of the rest. - Please try to move your intrinsics into the target subdirectory. So far only Blackfin has done that, but we would like to keep everything target-specific in lib/Target/MBlaze. - Please use lower-case register names in assembly if the assembler allows it. - I think you have some literal tabs in your instruction descriptions. - Your tests are nice, but you could use some more of them. I would recommend tests for tricky calling convention stuff, some loops, switches and branches. Also indirect calls and indirect branches. Have you tries running Codegen/generic through your back end? That should give you some more test cases. The MicroBlaze is highly configurable and fairly simple. It would be a great addition to LLVM, also for educational purposes. /jakob
> Your patch looks very clean. Some comments:Heh, Jakob was faster :)> - I think you have some literal tabs in your instruction descriptions.The tabs can be seen in some other places as well. Also, there is a "mix" of coding conventions in the files. It will be really nice to use only one :)> - Your tests are nice, but you could use some more of them. I would recommend tests for tricky calling convention stuff, some loops, switches and branches. Also indirect calls and indirect branches. Have you tries running Codegen/generic through your back end? That should give you some more test cases.Some "feature" tests can be found inside other directories as well, e.g. msp430 / systemz. Are you planning to add microblaze description to clang? C compiler can speed up testing alot :) More comments:>+SDValue MBlazeTargetLowering:: >+LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) {Do you really need this? Expanding dynamic allocas normally ends with stack register adjustment, you don't need anything special here.>+bool MBlazeTargetLowering:: >+SelectAddrRegReg(SDValue N, SDValue &Base, SDValue &Index, SelectionDAG &DAG) {Move this to ISelDAGToDAG file>+bool MBlazeTargetLowering:: >+SelectAddrRegImm(SDValue N, SDValue &Disp, SDValue &Base, SelectionDAG &DAG) {Likewise>+def : Proc<"v400", []>; >+def : Proc<"v500", []>; >+def : Proc<"v600", []>; >+def : Proc<"v700", []>; >+def : Proc<"v710", []>;What's the difference between them then? isVN00() predicates are not used.>+ DataLayout(std::string("E-p:32:32-i8:8:8-i16:16:16-n32")),I'm confused. What are the native types for this arch?>+static cl::opt<bool> HasFPUOpt( >+ "mb-has-fpu",As Jakob already said - remove these, you should use subtarget features (-mattr=+foo) instead. As I understand, some features are not hooked yet, like>+def FeaturePipe3 : SubtargetFeature<"pipe3", "HasPipe3", "true", >+ "Implements 3-stage pipeline.">;? Otherwise patch looks good. Thanks! -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University