summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomer Hsing <homer.xing@intel.com>2012-09-17 16:01:16 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2012-09-26 23:27:00 -0400
commit95a4762a71a23d0f016f62ff5f0105eb815e78f1 (patch)
treeeebeea37605ea02b8fb8420d6564ed796fcceff9
parent7aaad71a65473c4d58227c25867ad00d7793740c (diff)
Pad NOP instructions instead of the ILLEGAL instruction for entry
If a label is an entry, the assembler will pad empty instruction before the label until offset % 4 == 0. In the past, the ILLEGAL instructions are padded. It may raise exceptions. We use the NOP instructions instead.
-rw-r--r--src/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 49f201c..4e2117e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -287,9 +287,10 @@ int main(int argc, char **argv)
entry->inst_offset = inst_offset;
entry1 = entry->next;
if (entry1 && entry1->islabel && is_entry_point(entry1->string)) {
- // insert empty instructions until (inst_offset+1) % 4 == 0
+ // insert NOP instructions until (inst_offset+1) % 4 == 0
while (((inst_offset+1) % 4) != 0) {
tmp_entry = calloc(sizeof(*tmp_entry), 1);
+ tmp_entry->instruction.header.opcode = BRW_OPCODE_NOP;
entry->next = tmp_entry;
tmp_entry->next = entry1;
entry = tmp_entry;