Browse Source

LLVM: list supported LLVM/Xcode versions

Use the -i or -il command line parameter
Jonas Maebe 3 years ago
parent
commit
3ef0db2404
2 changed files with 57 additions and 1 deletions
  1. 4 0
      compiler/msg/errore.msg
  2. 53 1
      compiler/options.pas

+ 4 - 0
compiler/msg/errore.msg

@@ -3845,6 +3845,9 @@ Supported Whole Program Optimizations:
 Code Generation Backend
   $CODEGENERATIONBACKEND
 
+Supported LLVM/Xcode versions (only available with LLVM Code Generation Backend)
+  $LLVMVERSIONS
+
 Supported Microcontroller types:$\n  $CONTROLLERTYPES$\n
 This program comes under the GNU General Public Licence
 For more information read COPYING.v2
@@ -4092,6 +4095,7 @@ A*2CV<x>_Set section threadvar model to <x>
 **2iD_Return compiler date
 **2if_Return list of supported FPU instruction sets
 **2ii_Return list of supported inline assembler modes
+L*2il_Return list of supported LLVM/Xcode versions by the LLVM backend
 **2im_Return list of supported modeswitches
 **2io_Return list of supported optimizations
 **2ir_Return list of recognized compiler and RTL features

+ 53 - 1
compiler/options.pas

@@ -232,6 +232,7 @@ const
   FeatureListPlaceholder = '$FEATURELIST';
   ModeSwitchListPlaceholder = '$MODESWITCHES';
   CodeGenerationBackendPlaceholder = '$CODEGENERATIONBACKEND';
+  LLVMVersionPlaceholder = '$LLVMVERSIONS';
 
   procedure SplitLine (var OrigString: TCmdStr; const Placeholder: TCmdStr;
                                                  out RemainderString: TCmdStr);
@@ -730,6 +731,51 @@ const
       WriteLn(xmloutput,'    <codegeneratorbackend>',cgbackend2str[cgbackend],'</codegeneratorbackend>');
     end;
 
+  procedure ListLLVMVersions (OrigString: TCmdStr);
+{$ifdef LLVM}
+    var
+      llvmversion : tllvmversion;
+{$endif LLVM}
+    begin
+{$ifdef LLVM}
+      SplitLine (OrigString, LLVMVersionPlaceholder, HS3);
+      for llvmversion:=low(llvmversion) to high(llvmversion) do
+       begin
+        hs1:=llvmversionstr[llvmversion];
+        if hs1<>'' then
+         begin
+          if OrigString = '' then
+           Comment (V_Normal, hs1)
+          else
+           begin
+            hs:=OrigString;
+            Replace(hs,LLVMVersionPlaceholder,hs1);
+            Comment(V_Normal,hs);
+           end;
+         end;
+       end;
+{$else LLVM}
+      Comment (V_Normal, '')
+{$endif LLVM}
+    end;
+
+  procedure ListLLVMVersionsXML;
+{$ifdef LLVM}
+    var
+      llvmversion : tllvmversion;
+{$endif LLVM}
+    begin
+{$ifdef LLVM}
+      WriteLn(xmloutput,'    <llvmversions>');
+      for llvmversion:=Low(tllvmversion) to High(tllvmversion) do
+        if llvmversionstr[llvmversion]<>'' then
+          WriteLn(xmloutput,'      <llvmversion name="',llvmversionstr[llvmversion],'"/>');
+      WriteLn(xmloutput,'    </llvmversions>');
+{$endif LLVM}
+    end;
+
+
+
 begin
   if More = '' then
    begin
@@ -761,6 +807,8 @@ begin
        ListFeatures (S)
       else if pos(CodeGenerationBackendPlaceholder,s)>0 then
        ListCodeGenerationBackend (S)
+      else if pos(LLVMVersionPlaceholder,s)>0 then
+       ListLLVMVersions (s)
       else
        Comment(V_Normal,s);
      end;
@@ -783,6 +831,7 @@ begin
       ListControllerTypesXML;
       ListFeaturesXML;
       ListCodeGenerationBackendXML;
+      ListLLVMVersionsXML;
       WriteLn(xmloutput,'  </info>');
       WriteLn(xmloutput,'</fpcoutput>');
       Close(xmloutput);
@@ -800,6 +849,9 @@ begin
         'c': ListCPUInstructionSets ('');
         'f': ListFPUInstructionSets ('');
         'i': ListAsmModes ('');
+{$ifdef LLVM}
+        'l': ListLLVMVersions ('');
+{$endif LLVM}
         'm': ListModeswitches ('');
         'o': ListOptimizations ('');
         'r': ListFeatures ('');
@@ -2287,7 +2339,7 @@ begin
            'i' :
              begin
                if (More='') or
-                    (More [1] in ['a', 'b', 'c', 'f', 'i', 'm', 'o', 'r', 't', 'u', 'w', 'x']) then
+                    (More [1] in ['a', 'b', 'c', 'f', 'i', {$ifdef LLVM}'l',{$endif} 'm', 'o', 'r', 't', 'u', 'w', 'x']) then
                  WriteInfo (More)
                else
                  QuickInfo:=QuickInfo+More;