Add metadata types to AST.

master
Rohan Jacob-Rao 9 years ago
parent 394a3b4c29
commit b3b67cdf69

@ -35,6 +35,15 @@ type typ =
| Tlabel | Tlabel
| Tmetadata | Tmetadata
type metadata =
| MetadataVar of int
| MetadataString of string
| MetadataNode of metadata_component list
and metadata_component =
| TypOperand of typ option * operand
| Metadata of metadata
type instr = type instr =
| Ret of (typ * operand) option | Ret of (typ * operand) option
| UncondBranch of variable | UncondBranch of variable

@ -170,22 +170,22 @@ target_triple:
metadata_def: metadata_def:
| name = NAMED_METADATA EQUALS numbered_metadata_node { () } | name = NAMED_METADATA EQUALS numbered_metadata_node { () }
| num = NUMBERED_METADATA EQUALS metadata_node { () } | metadata_id = NUMBERED_METADATA EQUALS metadata_node { () }
numbered_metadata_node: numbered_metadata_node:
| METADATA_NODE_BEGIN separated_list(COMMA, NUMBERED_METADATA) RBRACE { () } | METADATA_NODE_BEGIN metadata_ids = separated_list(COMMA, NUMBERED_METADATA) RBRACE { metadata_ids }
metadata_node: metadata_node:
| METADATA? METADATA_NODE_BEGIN separated_list(COMMA, metadata_component) RBRACE { () } | METADATA? METADATA_NODE_BEGIN components = separated_list(COMMA, metadata_component) RBRACE { MetadataNode components }
metadata_component: metadata_component:
| tp = typ? op = operand { () } | tp = typ? op = operand { TypOperand (tp, op) }
| METADATA? metadata_value { () } | METADATA? value = metadata_value { Metadata value }
metadata_value: metadata_value:
| NUMBERED_METADATA { () } | i = NUMBERED_METADATA { MetadataVar i }
| METADATA_STRING { () } | str = METADATA_STRING { MetadataString str }
| metadata_node { () } | node = metadata_node { node }
func_def: func_def:
| DEFINE ret_tp = ret_typ name = variable LPAREN | DEFINE ret_tp = ret_typ name = variable LPAREN

Loading…
Cancel
Save