NaplesPU Libraries

From NaplesPU Documentation
Revision as of 16:43, 25 May 2018 by Edo (talk | contribs) (libcompiler)
Jump to: navigation, search

NuPlus is provided with different kind of libraries that are contained in the libs/ folder.

libc

We implemented our custom version of the following standard C libraries:

  • ctype
  • math
  • stdlib
  • string

Note that these libraries are not fully developed and, hence, some functions may be missing. In particular, dynamic memory management (calloc, free, malloc, realloc) and environment (abort, atexit, at_quick_exit, exit, getenv, quick_exit, system) functions are not implemented. In addition, we redefined the stdint.h header file in order to provide a set of typedefs that specify vector types.

During compilation, these libraries are archived together into a single file, i.e. libc.a, using the llvm-ar archiver.

libcompiler

This folder contains the libraries that are required by the compiler to handle some arithmetic operations that are not legal in the target architecture. In particular, we implemented the following libraries:

  • divdi3.c: signed 64-bit integer division
  • divsi3.c: signed 32-bit integer division
  • moddi3.c: signed 64-bit integer modulus
  • modsi3.c: signed 32-bit integer modulus
  • udivdi3.c: unsigned 64-bit integer division
  • udivsi3.c: unsigned 32-bit integer division
  • umoddi3.c: unsigned 64-bit integer modulus
  • umodsi3.c: unsigned 32-bit integer modulus

A proper lib call is generated when lowering the following node types:

  • ISD::UDIV
  • ISD::UREM
  • ISD::SDIV
  • ISD::SREM

This happends because the above nodes are set to Expand inside the NuPlusISelLowering.cpp file.

crt0