Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit d8998e4

Browse files
committed
Remove IRState from glue completely
1 parent c52dbcd commit d8998e4

9 files changed

Lines changed: 210 additions & 262 deletions

File tree

gcc/d/ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
(get_frame_for_symbol): Likewise.
66
(build_local_var): Likewise.
77
(get_decl_tree): Likewise.
8+
(start_function): Likewise.
89
* d-irstate.h(IRState): Move func, mod, sthis, deferred,
910
statementList, and varsInScope fields to...
1011
* d-tree.h(language_function): Here, updated all uses.
12+
* d-irstate.h: Remove file.
13+
(IRState): Remove all uses everywhere.
1114

1215
2015-08-07 Iain Buclaw <ibuclaw@gdcproject.org>
1316

gcc/d/d-codegen.cc

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include "d-tree.h"
4343
#include "d-lang.h"
4444
#include "d-objfile.h"
45-
#include "d-irstate.h"
4645
#include "d-codegen.h"
4746
#include "id.h"
4847

@@ -213,7 +212,7 @@ add_stmt(tree t)
213212
}
214213

215214
//
216-
IRState *
215+
void
217216
start_function(FuncDeclaration *decl)
218217
{
219218
cfun->language = ggc_cleared_alloc<language_function>();
@@ -231,8 +230,6 @@ start_function(FuncDeclaration *decl)
231230
}
232231
gcc_assert(cfun->language->module != NULL);
233232

234-
current_irstate = new IRState();
235-
236233
// Check if we have a static this or unitest function.
237234
ModuleInfo *mi = current_module_info;
238235

@@ -256,8 +253,6 @@ start_function(FuncDeclaration *decl)
256253
}
257254
else if (decl->isUnitTestDeclaration())
258255
mi->unitTests.safe_push(decl);
259-
260-
return current_irstate;
261256
}
262257

263258
void
@@ -921,11 +916,11 @@ d_array_convert (Expression *exp)
921916
TY ty = exp->type->toBasetype()->ty;
922917

923918
if (ty == Tarray)
924-
return exp->toElem (current_irstate);
919+
return exp->toElem(NULL);
925920
else if (ty == Tsarray)
926921
{
927922
Type *totype = exp->type->toBasetype()->nextOf()->arrayOf();
928-
return convert_expr (exp->toElem (current_irstate), exp->type, totype);
923+
return convert_expr (exp->toElem(NULL), exp->type, totype);
929924
}
930925

931926
// Invalid type passed.
@@ -1172,7 +1167,7 @@ build_attributes (Expressions *in_attrs)
11721167
aet = build_string (s->len, (const char *) s->string);
11731168
}
11741169
else
1175-
aet = ae->toElem (current_irstate);
1170+
aet = ae->toElem(NULL);
11761171

11771172
args = chainon (args, build_tree_list (0, aet));
11781173
}
@@ -2211,13 +2206,13 @@ build_binop_assignment(tree_code code, Expression *e1, Expression *e2)
22112206
if (e1b->op == TOKcomma)
22122207
{
22132208
CommaExp *ce = (CommaExp *) e1b;
2214-
lexpr = ce->e1->toElem(current_irstate);
2215-
lhs = ce->e2->toElem(current_irstate);
2209+
lexpr = ce->e1->toElem(NULL);
2210+
lhs = ce->e2->toElem(NULL);
22162211
}
22172212
else
2218-
lhs = e1b->toElem(current_irstate);
2213+
lhs = e1b->toElem(NULL);
22192214

2220-
tree rhs = e2->toElem(current_irstate);
2215+
tree rhs = e2->toElem(NULL);
22212216

22222217
// Build assignment expression. Stabilize lhs for assignment.
22232218
lhs = stabilize_reference(lhs);
@@ -2392,7 +2387,6 @@ d_build_call (FuncDeclaration *fd, tree object, Expressions *args)
23922387
tree
23932388
d_build_call (TypeFunction *tf, tree callable, tree object, Expressions *arguments)
23942389
{
2395-
IRState *irs = cfun ? current_irstate : NULL;
23962390
tree ctype = TREE_TYPE (callable);
23972391
tree callee = callable;
23982392
tree saved_args = NULL_TREE;
@@ -2452,7 +2446,7 @@ d_build_call (TypeFunction *tf, tree callable, tree object, Expressions *argumen
24522446
if (arg->op == TOKcomma)
24532447
{
24542448
CommaExp *ce = (CommaExp *) arg;
2455-
tree tce = ce->e1->toElem (irs);
2449+
tree tce = ce->e1->toElem(NULL);
24562450
saved_args = maybe_vcompound_expr (saved_args, tce);
24572451
(*arguments)[i] = ce->e2;
24582452
goto Lagain;
@@ -2472,19 +2466,19 @@ d_build_call (TypeFunction *tf, tree callable, tree object, Expressions *argumen
24722466
if (i < dvarargs)
24732467
{
24742468
// The hidden _arguments parameter
2475-
targ = arg->toElem (irs);
2469+
targ = arg->toElem(NULL);
24762470
}
24772471
else if (i - dvarargs < nparams && i >= dvarargs)
24782472
{
24792473
// Actual arguments for declared formal arguments
24802474
Parameter *parg = Parameter::getNth (tf->parameters, i - dvarargs);
2481-
targ = convert_for_argument (arg->toElem (irs), arg, parg);
2475+
targ = convert_for_argument (arg->toElem(NULL), arg, parg);
24822476
}
24832477
else
24842478
{
24852479
// Not all targets support passing unpromoted types, so
24862480
// promote anyway.
2487-
targ = arg->toElem (irs);
2481+
targ = arg->toElem(NULL);
24882482
tree ptype = lang_hooks.types.type_promotes_to (TREE_TYPE (targ));
24892483

24902484
if (ptype != TREE_TYPE (targ))
@@ -3136,7 +3130,7 @@ build_float_modulus (tree type, tree arg0, tree arg1)
31363130
tree
31373131
build_typeinfo (Type *t)
31383132
{
3139-
tree tinfo = t->getInternalTypeInfo (NULL)->toElem (current_irstate);
3133+
tree tinfo = t->getInternalTypeInfo (NULL)->toElem(NULL);
31403134
gcc_assert (POINTER_TYPE_P (TREE_TYPE (tinfo)));
31413135
return tinfo;
31423136
}

gcc/d/d-codegen.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct FuncFrameInfo
5151
};
5252

5353
// Visitor routines for barrier between frontend and glue.
54-
void build_ir(FuncDeclaration *fd, IRState *irs);
54+
void build_ir(FuncDeclaration *fd);
5555
tree build_ctype(Type *t);
5656

5757
// Code generation routines.
@@ -62,7 +62,7 @@ extern void push_stmt_list();
6262
extern tree pop_stmt_list();
6363
extern void add_stmt(tree t);
6464

65-
extern IRState *start_function(FuncDeclaration *decl);
65+
extern void start_function(FuncDeclaration *decl);
6666
extern void end_function();
6767

6868
extern tree d_decl_context (Dsymbol *dsym);
@@ -279,7 +279,6 @@ extern bool call_by_alias_p (FuncDeclaration *caller, FuncDeclaration *callee);
279279

280280
// Globals.
281281
extern Module *current_module_decl;
282-
#define current_irstate (cfun->language->irs)
283282

284283
#endif
285284

0 commit comments

Comments
 (0)