What is the difference between an instruction and pseudo instruction in mips




















Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Symbolic machine instruction,Pseudo instruction difference Ask Question.

Asked 2 years, 8 months ago. Active 1 year, 3 months ago. Viewed times. What is the difference between Symbolic machine instruction and Pseudo instruction?

Can you give examples of them? Improve this question. Ben Bitdiddle Ben Bitdiddle 25 1 1 silver badge 4 4 bronze badges. I don't think I've ever heard the term "symbolic machine instruction" before so you'll have to define exactly what that means. Add a comment. Active Oldest Votes. Improve this answer. CS student CS student 13 2 2 bronze badges.

Sign up or log in Sign up using Google. Sign up using Facebook. The whole point of saving and restoring values on the stack or using callee-saved registers is preserving values across calls. As you would have already seen in your labs, SPIM supports named constants, which can be used in place of immediates. Named constants make code a lot easier to understand, since e. Since load and store instructions are limited to a bit immediate, loads and stores to labels often get expanded into two instructions: one to deal with the upper 16 bits and one to deal with the lower To see this in action, you can use this example code.

You can just stick with. There are two major things to keep in mind. Firstly, you should figure out what you need to optimize. Secondly, algorithm improvements beat micro-optimizations almost all the time - my highly tuned bubblesort will lose to even an extremely unoptimized quicksort.

For example, if I do. Of course, I could simply fix the non-optimal cases in the code generator itself as I found them, but what fun would that be?

One of the interesting things about MIPS is that there are specialized instructions for comparisons with zero - namely bgez , bgtz , blez and bltz - but arbitrary branch comparisons usually need to be expanded into an slt or slti followed by a comparison with zero.

Accessing arrays is a bit of drag in MIPS - you need to multiply the index by the size of each element, add that to the base pointer and then perform a load. You can skip the first two steps if you just manipulate pointers directly instead of doing a literal translation of the C code.

We can still do better if we check size before entering the loop, which enables us to convert the loop to a do-while loop:.



0コメント

  • 1000 / 1000