Difference between revisions of "Extending NaplesPU for 64-bit support"

From NaplesPU Documentation
Jump to: navigation, search
(nu+ frontend modifications)
(nu+ frontend modifications)
Line 7: Line 7:
  
 
nu+ frontend abstracts target informations through the ''TargetInfo'' class, extending it in the [[nu+ Clang Documentation #Defining Target Features | NuPlusTargetInfo]] implementation.
 
nu+ frontend abstracts target informations through the ''TargetInfo'' class, extending it in the [[nu+ Clang Documentation #Defining Target Features | NuPlusTargetInfo]] implementation.
 +
 +
=== Target Definition ===
 +
 
Since 64-bit operations require to support double-integer and double-floating-point formats, the following changes and additions are required in the target definition:
 
Since 64-bit operations require to support double-integer and double-floating-point formats, the following changes and additions are required in the target definition:
  
 
<syntaxhighlight>
 
<syntaxhighlight>
 
+
class LLVM_LIBRARY_VISIBILITY NuPlusTargetInfo : public TargetInfo {
 +
  ...
 +
public:
 +
  NuPlusTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
 +
    : TargetInfo(Triple) {
 +
    ...
 +
    resetDataLayout("e-m:e-p:32:32-i64:64:64-i32:32:32-f32:32:32-f64:64:64");
 +
    LongDoubleWidth = 64;
 +
    LongDoubleAlign = 64;
 +
    DoubleWidth = 64;
 +
    DoubleAlign = 64;
 +
    LongWidth = 64;
 +
    LongAlign = 64;
 +
    LongLongWidth = 64;
 +
    LongLongAlign = 64;
 +
  }
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 15:27, 5 April 2019

nu+ toolchain can be extended to support 64-bit operations. A git branch with full 64-bit support is provided. Consequently, if it is necessary to compile the toolchain supporting this extension, a checkout on llvm-7 branch is required.

Changes are related to both frontend and backend.

nu+ frontend modifications

nu+ frontend abstracts target informations through the TargetInfo class, extending it in the NuPlusTargetInfo implementation.

Target Definition

Since 64-bit operations require to support double-integer and double-floating-point formats, the following changes and additions are required in the target definition:

 class LLVM_LIBRARY_VISIBILITY NuPlusTargetInfo : public TargetInfo {
   ...
 public:
   NuPlusTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
     : TargetInfo(Triple) {
     ...
     resetDataLayout("e-m:e-p:32:32-i64:64:64-i32:32:32-f32:32:32-f64:64:64");
     LongDoubleWidth = 64;
     LongDoubleAlign = 64;
     DoubleWidth = 64;
     DoubleAlign = 64;
     LongWidth = 64;
     LongAlign = 64;
     LongLongWidth = 64;
     LongLongAlign = 64;
   }