mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
* RISC-V 32 compilation fixed
+ lazarus project file for the compiler added git-svn-id: branches/laksen/riscv_new@39511 -
This commit is contained in:
parent
14bfcbb0da
commit
44150f43ac
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -641,6 +641,7 @@ compiler/ppcmips.lpi svneol=native#text/plain
|
||||
compiler/ppcmipsel.lpi svneol=native#text/plain
|
||||
compiler/ppcppc.lpi svneol=native#text/plain
|
||||
compiler/ppcppc64.lpi svneol=native#text/plain
|
||||
compiler/ppcriscv32.lpi svneol=native#text/plain
|
||||
compiler/ppcriscv64.lpi svneol=native#text/plain
|
||||
compiler/ppcsparc.lpi svneol=native#text/plain
|
||||
compiler/ppcsparc64.lpi svneol=native#text/plain
|
||||
|
86
compiler/ppcriscv32.lpi
Normal file
86
compiler/ppcriscv32.lpi
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="ppcrv32"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default">
|
||||
<local>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</Mode0>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<Units Count="4">
|
||||
<Unit0>
|
||||
<Filename Value="pp.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="riscv32\aasmcpu.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="riscv32\aoptcpu.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="aopt.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="riscv32\pp"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="riscv32;riscv"/>
|
||||
<OtherUnitFiles Value="riscv32;riscv;systems"/>
|
||||
<UnitOutputDirectory Value="riscv32\lazbuild"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<CStyleOperator Value="False"/>
|
||||
<AllowLabel Value="False"/>
|
||||
<CPPInline Value="False"/>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Other>
|
||||
<Verbosity>
|
||||
<ShowWarn Value="False"/>
|
||||
<ShowNotes Value="False"/>
|
||||
<ShowHints Value="False"/>
|
||||
</Verbosity>
|
||||
<ConfigFile>
|
||||
<StopAfterErrCount Value="50"/>
|
||||
</ConfigFile>
|
||||
<CustomOptions Value="-driscv32
|
||||
-Sew"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
@ -163,7 +163,7 @@ unit cgcpu;
|
||||
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
|
||||
a_reg_alloc(list,NR_FRAME_POINTER_REG);
|
||||
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,0);
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,ctempposinvalid,0,[]);
|
||||
|
||||
{ Int registers }
|
||||
regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall);
|
||||
@ -248,7 +248,7 @@ unit cgcpu;
|
||||
regs:=regs+[RS_RETURN_ADDRESS_REG];
|
||||
|
||||
stackcount:=0;
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,0);
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,ctempposinvalid,0,[]);
|
||||
for r:=RS_X31 downto RS_X0 do
|
||||
if r in regs then
|
||||
dec(href.offset,4);
|
||||
@ -373,7 +373,7 @@ unit cgcpu;
|
||||
src:=src2
|
||||
else
|
||||
begin
|
||||
reference_reset(src,sizeof(aint));
|
||||
reference_reset(src,sizeof(aint),[]);
|
||||
{ load the address of src2 into src.base }
|
||||
src.base := GetAddressRegister(list);
|
||||
a_loadaddr_ref_reg(list, src2, src.base);
|
||||
@ -382,7 +382,7 @@ unit cgcpu;
|
||||
dst:=dst2
|
||||
else
|
||||
begin
|
||||
reference_reset(dst,sizeof(aint));
|
||||
reference_reset(dst,sizeof(aint),[]);
|
||||
{ load the address of dst2 into dst.base }
|
||||
dst.base := GetAddressRegister(list);
|
||||
a_loadaddr_ref_reg(list, dst2, dst.base);
|
||||
|
@ -38,6 +38,8 @@ uses
|
||||
|
||||
type
|
||||
TAsmOp=(A_None,
|
||||
{ Pseudo instructions }
|
||||
A_NOP,
|
||||
{ normal opcodes }
|
||||
A_LUI,A_AUIPC,A_JAL,A_JALR,
|
||||
A_Bxx,A_LB,A_LH,A_LW,A_LBU,A_LHU,
|
||||
|
@ -43,8 +43,8 @@ unit cpunode;
|
||||
nrvset,
|
||||
nrvinl,
|
||||
nrv32mat,
|
||||
nrv32cnv,
|
||||
nrvcon
|
||||
nrv32cnv
|
||||
// ,nrvcon
|
||||
;
|
||||
|
||||
end.
|
||||
|
@ -30,6 +30,7 @@ interface
|
||||
|
||||
const
|
||||
gas_op2str: array[tasmop] of string[14] = ('<none>',
|
||||
'nop',
|
||||
'lui','auipc','jal','jalr',
|
||||
'b','lb','lh','lw','lbu','lhu',
|
||||
'sb','sh','sw',
|
||||
|
@ -42,7 +42,7 @@ implementation
|
||||
cgbase,pass_2,
|
||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
nmem,nld,ncnv,
|
||||
ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
|
||||
ncgutil,cgutils,cgobj,tgobj,rgobj,rgcpu,
|
||||
cg64f32,cgcpu,cpupi,procinfo;
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ Unit rarv32gas;
|
||||
{ aasm }
|
||||
cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
{ symtable }
|
||||
symconst,symsym,
|
||||
symconst,symdef,symsym,
|
||||
{ parser }
|
||||
procinfo,
|
||||
rabase,rautils,
|
||||
@ -62,7 +62,7 @@ Unit rarv32gas;
|
||||
procedure trv32attreader.ReadSym(oper : trvoperand);
|
||||
var
|
||||
tempstr, mangledname : string;
|
||||
typesize,l,k : aint;
|
||||
l,k,typesize : tcgint;
|
||||
begin
|
||||
tempstr:=actasmpattern;
|
||||
Consume(AS_ID);
|
||||
@ -139,7 +139,7 @@ Unit rarv32gas;
|
||||
end;
|
||||
|
||||
var
|
||||
l : aint;
|
||||
l : tcgint;
|
||||
relsym: string;
|
||||
asmsymtyp: tasmsymtype;
|
||||
isflags: tindsymflags;
|
||||
@ -201,7 +201,7 @@ Unit rarv32gas;
|
||||
if (relsym<>'') then
|
||||
begin
|
||||
if (oper.opr.typ = OPR_REFERENCE) then
|
||||
oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
|
||||
oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym,AT_DATA)
|
||||
else
|
||||
begin
|
||||
Message(asmr_e_invalid_reference_syntax);
|
||||
@ -256,7 +256,7 @@ Unit rarv32gas;
|
||||
Procedure trv32attreader.BuildOperand(oper : trvoperand);
|
||||
var
|
||||
expr : string;
|
||||
typesize,l : aint;
|
||||
typesize,l : tcgint;
|
||||
|
||||
|
||||
procedure AddLabelOperand(hl:tasmlabel);
|
||||
@ -281,7 +281,7 @@ Unit rarv32gas;
|
||||
hasdot : boolean;
|
||||
l,
|
||||
toffset,
|
||||
tsize : aint;
|
||||
tsize : tcgint;
|
||||
begin
|
||||
if not(actasmtoken in [AS_DOT,AS_PLUS,AS_MINUS]) then
|
||||
exit;
|
||||
@ -319,7 +319,7 @@ Unit rarv32gas;
|
||||
if (oper.opr.val<>0) then
|
||||
Message(asmr_e_wrong_sym_type);
|
||||
oper.opr.typ:=OPR_SYMBOL;
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION);
|
||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION,voidcodepointertype);
|
||||
end
|
||||
else
|
||||
inc(oper.opr.val,l);
|
||||
|
Loading…
Reference in New Issue
Block a user